BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
| WebLogic Server Doc Home | JSP Tag Extensions | Previous Topic | Next Topic | Contents | Index | View as PDF

Administration and Configuration

The following sections provide an overview of administration and configuration tasks for using JSP tag extensions:

- Configuring JSP Tag Libraries

- Deploying a JSP Tag Library as a JAR File

Configuring JSP Tag Libraries

The following steps describe how to configure and deploy a JSP tag library. You can also deploy a tag library as a `jar` file (see Deploying a JSP Tag Library as a JAR File).

1. Create a tag library descriptor (TLD).

   For more information, see Creating a Tag Library Descriptor.

2. Reference this TLD in the Web Application deployment descriptor, `web.xml.` For example:

       <taglib>

         <taglib-uri>myTLD</taglib-uri>
         <taglib-location>WEB-INF/library.tld</taglib-location>

       </taglib>

   In this example the tag library descriptor is a file called `library.tld.` Always specify the location of the `tld` relative to the root of the Web Application.

   For more information on editing the Web Application deployment descriptor, see Taglib element.

3. Place the tag library descriptor file in the `WEB-INF` directory of the Web Application.

4. Reference the tag library in the JSP page

   In your JSP, reference the tag library with a JSP directive. For example:

       <%@ taglib uri="myTLD" prefix="mytaglib" %>

   For more information on WebLogic JSP, see Programming WebLogic JSP.

5. Place the tag handler Java class files for your tags in the `WEB-INF/classes` directory of your Web Application.

6. Deploy the Web Application on WebLogic Server. For more information, see Deploying Web Applications.

Deploying a JSP Tag Library as a JAR File

In addition to the procedure described above, you can also deploy a JSP tag library as a `jar` file:

1. Create a TLD (tag library descriptor) file named `taglib.tld`.

   For more information, see Creating a Tag Library Descriptor.

2. Create a directory containing the compiled Java tag handler class files used in your tag library.

3. Create a subdirectory of the above directory called `META-INF`.

4. Copy the `taglib.tld` file you created in step 1. into the `META-INF` directory you created in step 3.

5. Archive your compiled Java class files into a `jar` file by executing the following command from the directory you created in step 2.

       jar cv0f myTagLibrary.jar

   (where `myTagLibrary.jar` is a name you provide)

6. Copy the `jar` file into the `WEB-INF/lib` directory of the Web Application that uses your tag library.

7. Reference this tag library descriptor in the Web Application deployment descriptor, `web.xml.` For example:

       <taglib>
           <taglib-uri>myjar.tld</taglib-uri>
           <taglib-location>
                 /WEB-INF/lib/myTagLibrary.jar
           </taglib-location>
       </taglib>

   For more information, see Writing Web Application Deployment Descriptors.

8. Reference the tag library in your JSP. For example:

       <%@ taglib uri="myjar.tld" prefix="wl" %>

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.