[ Team LiB ] Previous Section Next Section

JSP Tag Library Syntax

Tag libraries are used within the context of a WebLogic application. To use tags within a tag library, the tag library's uri (file location) must first be registered within the application's web.xml (application deployment descriptor) file. This file is located in the application's ..\WEB-INF directory. The tag library's XML syntax is follows:


<taglib>
  <taglib-uri>name.tld</taglib-uri>
  <taglib-location>
    /WEB-INF/lib/name-tags.jar
  </taglib-location>
</taglib>

To use the library within your JSP page after the tag library's uri is set, you must reference the tag library using the taglib directive with the syntax that follows:

WebLogic JSP shorthand


<%@ taglib uri="name-tags.tld" prefix="yourPrefix" %>

XML equivalent


<jsp:directive.taglib uri="name-tags.tld" prefix="yourPrefix" />

Refer to Table 15.3 in Chapter 15, "Writing WebLogic Server JavaServer Pages," for a complete listing of taglib directive attributes. After the tag library is referenced within your JSP page, you can reference tags within the library using JSP syntax as follows:


<yourPrefix:tagName attributes>
 optional tag specific body
</yourPrefix:tagName>

See Chapter 18 for further examples of using tag libraries.

    [ Team LiB ] Previous Section Next Section