Introduction


JavaServer Page's custom tags and tag handlers are designed to help you invent your own tags. While this is a powerful tool for Java web developers, developing custom tags entails a steep learning curve and can be time consuming. Luckily, some hard-working volunteer software developers have developed a bunch of highly useful tags for you. This tag collection is called the JavaServer Pages Standard Tag Library (JSTL). The JSTL specification arises from the Java Community Process (JSR-052) and the Apache Jakarta Project has developed a JSTL implementation, the Standard 1.0 taglib.

The JSTL has very broad functionality. It includes tags that:

  1. Set object attributes for web applications ( c:set ).

  2. Output text to web pages ( c:out and x:out ).

  3. Iterate over collections of data ( c:forEach and x:forEach ).

  4. Format numbers , dates, and currencies using different international styles (e.g., fmt:formatDate , fmt:formatNumber ).

  5. Transform XML ( x:transform ).

  6. Interact with databases using SQL (e.g., sql:query , sql:update ).

  7. Allow you to embed function calls in JSP code and template text (e.g., fn:substring( ) ). This functionality is available only with JSP 2.0 and JSTL 1.1 (see Recipe 23.14).

The JSTL originated a very important new JSP technology, the Expression Language (EL). This is a scripting language based generally on JavaScript and other scripting tools that, with JSP 2.0, can be embedded in HTML template text.

The EL was once part of JSTL 1.0 but has now migrated to the JSP specification. The EL must be implemented with JSP 2.0 containers such as Tomcat 5.


This chapter is designed to start you quickly with the JSTL, which commonly has to be downloaded and installed in a web application. Many web containers eventually integrate or have already integrated a JSTL implementation with their servlet and JSP engines.



Java Servlet & JSP Cookbook
Java Servlet & JSP Cookbook
ISBN: 0596005725
EAN: 2147483647
Year: 2004
Pages: 326

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net