Download
jsp tag library n.
Skip this Video
Loading SlideShow in 5 Seconds..
JSP Tag Library PowerPoint Presentation
Download Presentation
JSP Tag Library

JSP Tag Library

115 Views Download Presentation
Download Presentation

JSP Tag Library

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. JSP Tag Library CSCI 4300 Notes from Steve Small, http://www.javaworld.com/javaworld/jw-02-2003/jw-0228-jstl.html

  2. What is the Tag library? • Creates additional XML-style tags • Provide programming functionality with (somewhat) less mess • Standard tag library: • Core functions (output, control statements) • Formatting • Internationalization • SQL

  3. Installing the standard library • Download and install JSTL support in Tomcat • Declare in web.xml: • <taglib>    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>    <taglib-location>/WEB-INF/c.tld</taglib-location>  </taglib> • Include taglib descriptor file c.tld in WEB-INF • <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

  4. Core STL Example • <b>Parameter values passed to this page for each parameter: </b> • <table border="2"><c:forEach var="current" items="${param}">    <tr>    <td>    <b><c:out value="${current.key}" /></b>    </td>        <c:forEach var="aVal" items="${paramValues[current.key]}">            <td>            <c:out value="${aVal}" />            </td>        </c:forEach>    </tr></c:forEach></table> • Param and paramValues are global Map vars from Web container

  5. JSP Expression Language • Similar to PHP or Perl string interpolation • ${variable-name} = value of that variable • <c:out value="${anExpression}"/><c:out value="literalText${anExpression}${anotherExpression}"/><c:out value="literalText"/> • ${anObject.aProperty}${anObject["aPropertyName"]}${anObject[aVariableContainingPropertyName]}