Is there an if-else tag available in JSTL?
The if...else block starts out as an ordinary Scriptlet, but the Scriptlet is closed at each line with HTML text included between the Scriptlet tags.
The < c:if > tag is used for testing the condition and it display the body content, if the expression evaluated is true. It is a simple conditional tag which is used for evaluating the body content, if the supplied condition is true.
You can use <c:if> and <c:choose> tags to make conditional rendering in jsp using JSTL.
A tag library defines a collection of custom actions. The tags can be used directly by developers in manually coding a JSP page, or automatically by Java development tools. A tag library must be portable between different JSP container implementations.
Yes, but it's clunky as hell, e.g.
<c:choose> <c:when test="${condition1}"> ... </c:when> <c:when test="${condition2}"> ... </c:when> <c:otherwise> ... </c:otherwise> </c:choose>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With