Mark Roth: For many applications, embedding
Java code (scriptlets) in your JSP pages can make your pages more difficult to read and maintain (among other problems). Let's take a simple example:
<% Map m = (Map)pageContext.getAttribute("state");
State s = ((State)m.get( "NY" ));
if( s != null ) {%><% }
%>
The JSP Standard Tag Library (JSTL) introduced a language called SPEL (the Simplest Possible Expression Language) to help make writing JSP pages simpler. For example, the above example can be rewritten as follows:
${state["NY"].capitol}
This is obviously much easier to read. In the JSP 2.0 release, by popular demand, we've integrated the EL so it can now be used directly in your template text, and inside attributes of all tag libraries!
Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0