Chapter 11. Creating Your Own Tag Libraries

printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    

JSTL: JSP Standard Tag Library Kick Start
By Jeff Heaton

Table of Contents


Chapter 11. Creating Your Own Tag Libraries

In this chapter, we show you how to create custom tag libraries. We focus particularly on creating tag libraries that work well with the JSTL tag library. By designing your tag libraries so that they can deal with JSTL scoped variables and the JSP 1.3 expression language (EL), you will be able to create tag libraries that easily integrate with JSTL code.

Tag libraries allow you to take procedures that would be lengthy to write using just JSTL and encapsulate them in a tag. One perfect example of this is the JSTL SQL tags. It is generally not a good idea to put SQL database code in JSP pages. Database code is an implementation detail that should be separated from the presentation-oriented JSP pages. The example we present in this chapter shows you how to take our forum example from Chapter 10, "Understanding JSTL Internationalization," and isolate all the database logic behind a custom tag library. We begin with a discussion of how we should structure the tag library.


    printer-friendly version of this section  Print  e-mail this section  E-Mail  add a public, group or private note  Add Note  add a bookmark about this section  Add Bookmark    
    Top

    [0672324504/ch11]

     
     


    JSTL. JSP Standard Tag Library Kick Start
    JSTL: JSP Standard Tag Library Kick Start
    ISBN: 0672324504
    EAN: 2147483647
    Year: 2001
    Pages: 93
    Authors: Jeff Heaton

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