Jakarta Taglibs

Jakarta Taglibs

Name that Tag

Let's look at the Jakarta tag libraries that are available and what each provides.

At the time of this writing there were twenty supported libraries and one unsupported library. There seem to be new libraries added constantly. If you are interested in using a specific library, it is best to check the Jakarta site for specific installation instructions and requirements for that taglib.

The application taglib contains tags that can be used to access information contained in the ServletContext. Tags that are defined in application scope as well as application init parameters can be accessed. Tags are included for setting, getting, removing, and testing of attributes. Looping and value testing are provided for init parameters. A sample tag from this library looks like

 <app:equalsattribute name="sue" match="oreilly">
The application attribute with name sue matches the string "oreilly".
 </app:equalsattribute>

The Bean Scripting Framework (BSF) is used for incorporating various scripting into Java applications and applets. Supported scripts in BSF include Javascript, VBScript, Perl, Tcl, Python, NetRexx, and Rexx. If you are interested in more details pertaining to BSF you can check out IBM's Bean Scripting Framework page. The BSF taglib allows any of these languages to be used in JSPs. There are scriptlet tags that are the equivalent of <% in a JSP, and expression tags that are equivalent to <%=. You specify which language you are using to the tag.

The DateTime taglib makes dealing with dates and times easier. It contains tags that handle formatting, generating dates, using time zones, dealing with localization, and parsing. It doesn't get much easier than

<%-- Display the current time formatted --%>
The current time is: <dt:format pattern="MM/dd/yyyy hh:mm"><dt:currenttime/></dt:format>

DBTags, formerly called JDBC, contain tags that can be used to read and write to an SQL database. It includes connection management, creating and executing statements, prepared statements, testing and formatting of result sets. To say that this taglib could save you hours of coding is probably an understatement; having some understanding of JDBC helps.

The I18N taglib is useful for creating internationalized web applications. The bundle tag is used for loading the resource bundle based on locale, while the message tag is used for looking up keys in the bundle.

The Input taglib allows the user to present HTML <form> elements that are tied to the ServletRequest. Tags in this lib allow for default values to be placed on forms when necessary. This lib is optimized for a special case -- tying data to the ServletRequest object and providing the standard form elements.

The IO library allows URLs and HTTP requests to be performed. So JSP can be used to perform HTTP GET or PUT operations and to make XML-RPC and SOAP requests. Currently the IO library supports any protocol supported by the Java URL class. This includes file system, FTP, HTTP, HTTPS, XML-RPC, and SOAP. The <jsp:include> is only capable of including a servlet that is in your current web application. The <io:request> included in this taglib can be used to make "server side include" style calls to any web server anywhere for any resource. There is also a Unix-like pipe tag that can be used to pipe between tags that can't pipe themselves.

The JNDI Library creates an instance of a javax.naming.Context from attributes providing some of the standard values. Attributes can include URL, initialFactory, id, and scope. You can also do lookups, searches, and listings of contexts.

The JSP Spec taglib is the resource to use if you are looking for examples of how to do the things described in version 1.1 of the JSP specification. This library focuses on techniques more than on production scenarios. It can be useful to those just coming up to speed on writing custom tag libraries.

Prev  [1] [2] [3] Next

Close    To Top
  • Prev Article-Java:
  • Next Article-Java:
  • Now: Tutorial for Web and Software Design > Java > Java Servlets > Java Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction