1 / 5

JSP Tag Library

JSP Tag Library. CSCI 4300 Notes from Steve Small, http://www.javaworld.com/javaworld/jw-02-2003/jw-0228-jstl.html. What is the Tag library?. Creates additional XML-style tags Provide programming functionality with (somewhat) less mess Standard tag library:

aradia
Download Presentation

JSP Tag Library

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

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]}

More Related