Pramati Technologies

Packaging Tags

The Package Tool helps in building an archive of taglib components. The archive consists of Tag classes, other classes and the XML Tag Library Descriptor file.

The Tag Library Descriptor (TLD) file describes a tag library. A JSP container uses the TLD for a tag library, to interpret pages that include taglib directives referring to that tag library. The TLD is also used by JSP page authoring tools that will generate JSP pages that use a library, and by authors who do the same manually.

Creating a Taglib

Tools > Package > Taglib > New

A dialog box pops up where the name of the Taglib is to be given. The Taglibs get saved under the specified JAR node in the Desk. Clicking on OK creates a new Taglib JAR.

The following details can be edited under the Details section:

Storing a Taglib

There are two ways of storing the taglib created and using them in a JSP:

  1. In the first method,
    • Create a Taglib under the WEB-INF/lib folder, which is under the Web Module folder in the Desk accepts files of type JAR.
    • In the JSP file that is created, give the taglib uri as WEB-INF/lib/taglib_name.jar where taglib_name is the name of the taglib created. This enables the jsp compiler to locate the taglib descriptor (taglib.tld).
  2. In the second method,
    • Create a Taglib in the location desired by you.
    • While packaging the WAR, you need to map the taglib URI used in the JSP and the location of the Taglib JAR in the WAR. To do this, open the WAR file and click on the Taglib node. Use the Add button to add the URI and location of the taglib.
    • The taglib URI has to be of the same value as the taglib URI directive used in the JSP.
    • The taglib location is mentioned so that the URI describing a tag library can be mapped to a Taglib descriptor. This is usually WEB-INF/lib/taglib_name.jar where taglib_name is the name of the taglib created.

The first method is recommended, as using the given structure requires no changes to be made while packaging the WAR. To know more about the second method, read the section on Packaging Web Components.

Adding Tags

Tools > Package > Taglib Name > Right Click > Add Tag

Select the Tag to be added to the Taglib and click on OK. This adds the Tag to the Taglib and the details can subsequently be viewed in the Tag node.

Selecting the Tag name displays the details on the right hand side of the window. The following details of the tag are displayed here. These details are not editable:

Add and Remove the attributes that the tag requires to the taglib descriptor file. Set the following sub-elements of the attribute here:

To delete a tag that has been added to the taglib JAR, click on Delete. After adding all the tags in the taglib JAR, assemble the taglib JAR into a WAR file.

Updating Taglib

Taglib file on the Desk> Right Click > Update

Updates the taglib, static content like HTML, images and all classes. If the package names of the above are changed, then the changed components are not updated. Files like HTML, and images are stored with their absolute paths and therefore may not be located if they have been moved from their original location.

These files that are stored with their absolute paths, may not be located if they have been moved from their original location.

A log of update operations is available on the Update Tab in the Output area of Studio. This log shows normal messages in black, updating messages in green and any failures or errors in red. Usually a remedial measure is also provided in the case of errors. A progress bar indicates the progress of the operation.

A time stamp based update is used to update the taglibs, which makes the updating faster in most scenarios. Choosing Update brings up a dialog box with a progress bar. All the updating messages are displayed here. To stop updating the taglib, click on Cancel. Studio in the meantime can be used as usual but the taglib file being updated cannot be opened.

Saving Taglib

Tools > Package > Taglib > Save

Saves the open Taglib.

Closing Taglib

Tools > Package > Taglib > Close

This command closes the current Taglib. The Taglib is saved before closing.

Reverting Taglib

Tools > Package > Taglib > Revert

The Taglib can be restored to its last saved state.

Viewing XML Files

The META-INF/taglib.tld file corresponding to the Taglib JAR can be viewed in the XML node.


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX