What is JSTL (JSP Standard Tag Library)
is a collection of JSP custom tags developed by Java Community Process, www.jcp.org. The reference implementation is developed by the Jakarta project, jakarta.apache.org. JSTL offers tags through 4 libraries:
* core - Basic scripting functions
* xml - XML processing
* fmt - Internationalization of formatting
* sql - Data base accessing
We add them this way:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
Hello World! with JSTL:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <html><body> <c:out value="Hello world!"/> </body></html>
What is EL (Expression Language)
Before JSP 2.0, you could use only a scriptlet, JSP expression, or a custom tag to include server state in the JSP page output. Although these solutions are useful, they require a relatively large amount of work for even the simple job of accessing server-side state. JSP 2.0 incorporates the Expression Language (EL) first introduced in JSTL 1.0. So EL is an extension of JSTL.
A JSP 2.0 EL expression is always written between inside ${ … }.
<c:forEach var="k" items="${colors}"> <li><font color="${k}">This line is ${k}</font> </c:forEach> <c:forEach var="k" items="${events}"> <li><c:out value="${k.title}"/> </li> </c:forEach> <c:if test="${i.verified}"><img src="img/verified.png"/></c:if> <!-- if 'i.verified' is evaluated as 'true' --> <c:if test="${i.verified=='true'}"><img src="img/verified.png"/></c:if>
Property Access
Dot operator (.) can be used to retrieve a named property. To access numbered or named properties use the bracket operator ( [] ).
For example: ${user.name}, ${row[0]} or ${order.items.price}
Use the empty operator to determine whether a collection or string is empty or null . Example: <c:if test="${empty pageScope.users}">
More Reading
http://java.sun.com/developer/EJTechTips/2004/tt0126.html
http://bellsouthpwp.net/b/i/billsigg/jstl-quick-reference.pdf
http://cs.roosevelt.edu/eric/books/JSP/jstl-quick-reference.pdf





