Questions tagged [jstl]
JSTL (Jakarta Standard Tag Library) is a XML based standard tag library which offers tags to control the flow in a Facelets or JSP page, date/number formatting and internationalization facilities and several utility EL functions.
jstl
5,486
questions
427
votes
8
answers
849k
views
Evaluate empty or null JSTL c tags
How can I validate if a String is null or empty using the c tags of JSTL?
I have a variable named var1 and I can display it, but I want to add a comparator to validate it.
<c:out value="${var1}...
348
votes
7
answers
560k
views
How to use if-else option in JSTL
Is there an if-else tag available in JSTL?
319
votes
13
answers
1.0m
views
if...else within JSP or JSTL
I want to output some HTML code based on some condition in a JSP file.
if (condition 1) {
Some HTML code specific for condition 1
}
else if (condition 2) {
Some HTML code specific for ...
244
votes
4
answers
340k
views
Check a collection size with JSTL
How can I check the size of a collection with JSTL?
Something like:
<c:if test="${companies.size() > 0}">
</c:if>
191
votes
23
answers
493k
views
How to install JSTL? It fails with "The absolute uri cannot be resolved" or "Unable to find taglib" or NoClassDefFoundError or ClassCastException
I don't know what I've done incorrectly, but I can't include JSTL. I have jstl-1.2.jar, but unfortunately I get exception:
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/...
177
votes
3
answers
101k
views
JSTL in JSF2 Facelets... makes sense?
I would like to output a bit of Facelets code conditionally.
For that purpose, the JSTL tags seem to work fine:
<c:if test="${lpc.verbose}">
...
</c:if>
However, I'm not sure if ...
170
votes
14
answers
458k
views
How to do if-else in Thymeleaf?
What's the best way to do a simple if-else in Thymeleaf?
I want to achieve in Thymeleaf the same effect as
<c:choose>
<c:when test="${potentially_complex_expression}">
<h2>...
128
votes
5
answers
290k
views
How to get a index value from foreach loop in jstl
I have a value set in the request object like the following,
String[] categoriesList=null;
categoriesList = engine.getCategoryNamesArray();
request.setAttribute("categoriesList", categoriesList );
...
125
votes
2
answers
176k
views
Evaluate if list is empty JSTL
I've been trying to evaluate if this array list is empty or not but none of these have even compiled:
<c:if test="${myObject.featuresList.size == 0 }">
<c:if test="${...
125
votes
2
answers
115k
views
Loop through a Map with JSTL [duplicate]
I'm looking to have JSTL loop through a Map<String, String> and output the value of the key and it's value.
For example I have a Map<String, String> which can have any number of entries, ...
121
votes
5
answers
242k
views
JSP : JSTL's <c:out> tag
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the following both has the same result:
<p>The person's name is <c:out value="${person.name}" /></p>
&...
120
votes
7
answers
138k
views
How do you get the length of a list in the JSF expression language?
How would I get the length of an ArrayList using a JSF EL expression?
#{MyBean.somelist.length}
does not work.
110
votes
4
answers
265k
views
Use JSTL forEach loop's varStatus as an ID
I want to use the count from the JSTL forEach loop, but my code doesnt seem to work.
<c:forEach items="${loopableObject}" var="theObject" varStatus="theCount">
<div id="divIDNo${theCount}...
108
votes
13
answers
125k
views
Access Enum value using EL with JSTL
I have an Enum called Status defined as such:
public enum Status {
VALID("valid"), OLD("old");
private final String val;
Status(String val) {
this.val = val;
}
public ...
107
votes
4
answers
271k
views
How do I check two or more conditions in one <c:if>?
How do I check two conditions in one <c:if>? I tried this, but it raises an error:
<c:if test="${ISAJAX == 0} && ${ISDATE == 0}">