Java
  Home arrow Java arrow Page 3 - JSP Custom Tags: Bringing Components to th...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

JSP Custom Tags: Bringing Components to the Web
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2006-06-13

    Table of Contents:
  • JSP Custom Tags: Bringing Components to the Web
  • Creating a Custom Tag, Step By Step
  • Creating a Custom Tag continued
  • Custom Tags in the Real World

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    JSP Custom Tags: Bringing Components to the Web - Creating a Custom Tag continued


    (Page 3 of 4 )

    Creating the TLD File

    As mentioned before, a TLD file is an XML document that describes the library. The TLD  contains the information about the library as a whole, as well as about individual tags. The information about the complete library is provided with the XML tags in the following table.

    XML Tag

    Definition

    <taglib>

     The tag library itself. The following tags are the child nodes of this tag.

    <tlibversion>

    The tag library's version.

    <jspversion>

    The JSP  version that is required to make the tag work.

    <shortname>

    A simple default name with a mnemonic value. For example, <shortname>  may be used as the preferred prefix value in taglib directives and/or to create prefixes for IDs.

    <uri>

    An optional URI that uniquely identifies the tag library.

    <info>

    Descriptive information about the tag library.

               

     The tag specific info is described using the following XML tags: 

    • <tag>: The data about the tag itself is described by the siblings of this tag, which are detailed below. 
    • <name>: The name by which the tag would be accessed is given by this XML element. 
    • <tagclass>: The name of the class that handles the tag, a.k.a  the tag handler's name. the value of this element must be fully qualified Java name.
    • <bodycontent>: The value of this tag determines whether the content of the tag has to be considered or not. There can be three values: empty to indicate that the tag has no body, and that an error will be produced if it has one; tagdependent, to indicate that the body is only processed by tag; and JSP, which states that the JSP container should evaluate any body of the tag.
    • <attribute>: The info about the tag's attribute. The following child nodes provides various information:
      • <name>: Name of the attribute.
      • <required>: Declares whether the attribute is mandatory or not.
      • <rtexpvalue>: Lets the <attribute> tag use a runtime expression value if the value of this element is set to "true" or "yes."

    That covers the contents of the TLD file. In the next section I will be creating a tag. In it the above tags will be used to create the mapping. So here comes the (nearly) real world example.

    More Java Articles
    More By A.P.Rajshekhar


       · HiIn this article I have discussed the steps to create JSP Custom Tags. Hope it...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT