Please note: This page is imported from my wiki, which hasn't been updated in over 10 years. Some of the formatting was lost during the import. I'll try to get around to fixing it someday.
JSTL (JSP Standard Tag Library) is a collection of JSP tags included in the J2EE spec. It actually consists of five sets of tags
<%@ taglib prefix=“c” uri=”http://java.sun.com/jstl/core” %>
<c:set var=“myvar” value=“value”/>
<c:out value=”${myvar}”/>
Request atttibutes, request.getAttribute(“name”) are not needed, the are accessed by the ${name} syntax.
<c:forEach items=”${somelist}” var=“element”> do something with ${element} </c:forEach>
<c:choose> <c:when test=“sometest”> do something when test is true </c:when> <c:otherwise> do something when test is false </c:otherwise> <c:choose>
<jsp:useBean id=“now” class=“java.util.Date” />
”${not empty address.lastName}”
Andrew McDonough is a consultant CTO and software developer, currently based between Berlin and London.
Follow Andrew on Twitter or Connect on LinkedIn