Skip Headers
Oracle® Fusion Middleware Programming JSP Tag Extensions for Oracle WebLogic Server
12c Release 1 (12.1.1)

Part Number E24388-01
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
PDF · Mobi · ePub

5 Administration and Configuration

This chapter provides an overview of administration and configuration tasks for using JSP tag extensions.

This chapter includes the following sections:

Configuring JSP Tag Libraries

The following steps describe how to configure a JSP tag library. You can also package a tag library as a JAR file (see Packaging a JSP Tag Library as JAR File).

  1. Create a tag library descriptor (TLD).

    For more information, see Chapter 3, "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.

  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" %>
    
  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 and Packaging from a Split Development Directory" in Developing Applications for Oracle WebLogic Server.

Packaging a JSP Tag Library as JAR File

In addition to the procedure described in the previous section Configuring JSP Tag Libraries you can also package a JSP tag library as a JAR file:

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

    For more information, see Chapter 3, "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 directory you created in step 2 and call it 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 the tag library in your JSP. For example:

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

    A more flexible alternative would be to perform steps 1 through 6 and then reference the 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>
    . . .
    

    You can then reference the tag library in your JSP, for example:

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