Packaging and Deploying a Custom Tag Library

See Also

To deploy a tag library for use in a web module, you must first package it as a JAR file.

To package a tag library as a JAR file:

  1. In the Explorer, right-click the tag library descriptor to be packaged.
  2. From the contextual menu, choose Create Tag Library JAR. This action creates a file with a .jar extension. It also creates an associated jarContent file, also called a recipe file, which can be used to add additional classes or packages to the library.

You can deploy a custom tag library in three ways:

To test a tag library in place:

  1. If the tag library is not already in a web module, convert the filesystem containing the tag library into a web module using Tools and choose Convert Filesystem into Web Module. Leave the .tld file and the generated and compiled Java tag handler classes in place.
  2. Modify the Taglib element in the deployment descriptor to /<yourTagLib>.tld.
  3. Create a JSP, and add references to your new tags.
  4. Execute your JSP.

To modify the Taglib element in the deployment descriptor:

  1. Click the Deployment tab of the web.xml property sheet.
  2. Click the Tag Libraries value field, and click the ellipses (...) button.
  3. In the Tag Libraries property editor, select the tag library you want to modify, and click Edit.
  4. Edit the Taglib URI and/or Taglib Location and click OK.
  5. Click OK in the Tag Libraries property editor when you are finished modifying tag libraries.

To cut and paste the JAR File:

  1. In the Explorer, right-click the JAR file to be cut.
  2. From the contextual menu, choose Copy or Cut.
  3. Right-click the WEB-INF/lib directory into which you want to paste the JAR file.
  4. From the contextual menu, choose Paste.

Next, modify the Taglib element in the deployment descriptor so that it maps to the JAR file containing the desired tag library. This procedure is not always necessary. In some cases, the IDE adds the Taglib element automatically.

For more information about deploying custom tag libraries, see the Building Web Components Programming Guide, available from the Sun ONE Studio Developer Resources page at http://forte.sun.com/ffj/documentation.

See Also
Using Custom Tag Libraries in Web Modules
Adding a Custom Tag Library from the Filesystem
Web Modules (concepts)

Legal Notices