home.


Tagged: jstl-when


JSP: If else in JSTL

And if statement in JSTL is:

    <c:if test="${true}">
       Hiya
    </c>

And if-else is actually choose-when-otherwise:

    <c:choose>
       <c:when test="${true}">
         Hiya
       </c:when>
       <c:otherwise>
         Bye
       </c:otherwise>
    </c:choose>

Don’t forget to include the jstl taglib.

jsp jstl jstl-if jstl-when

Page 1 of 1