uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.3.4 Storing the tag library in the J2EE applications

With Application Server, you can store the tag library into the J2EE application and use the tag library from JSP.

The methods for using the tag library stored in the J2EE application from JSP differ based on whether the JSP is compiled using the J2EE server or using the cjjspc command.

When JSP is compiled using the J2EE server
Store the tag library in the library JAR.

When JSP is compiled using the cjjspc command
Store the tag library in the JAR file that is specified in the class path.

Both these methods are explained below.

Organization of this subsection
(1) When JSP is compiled using the J2EE server
(2) When compiling JSP using the cjjspc command

(1) When JSP is compiled using the J2EE server

By storing the tag library in the library JAR, you can use the tag library from JSP.

(a) Searching the TLD file

If the tag library is stored in a J2EE application as a library JAR, you cannot specify the TLD file with the <taglib> element of web.xml. In this case, set up the URI specified in the <uri> element of the TLD file in the uri property of the taglib directive of the JSP file. When the Web application starts, the TLD file saved in the library JAR is searched by the Web container. The URI coded in the <uri> element of the searched TLD file and the respective TLD file will be mapped.

Note that when the <uri> element does not exist, the URI and the respective TLD file is not mapped.

The mapping of the TLD file in the library JAR has the lowest priority level. Therefore, even if the URI of the TLD file in the library JAR is duplicated with another TLD file and web.xml in the mapping of the URI and TLD file, this will not affect the operations of the J2EE applications running on the versions prior to 07-60 version. For details on the priority levels in the mapping of the TLD file within library JAR, see 6.2.6(7) Mapping of URI and TLD files specified in the uri attribute of the taglib directive.

You can use the tag library in the JSP file by specifying URI in the uri attribute of the taglib directive.

(b) Tag library functionality that can be used when storing the tag library in the library JAR

The tag library functionality that you can use to store the tag library in the library JAR are the custom tag and the listener.

You cannot use a tag file. If you use a tag file stored in the library JAR for a JSP file or for a tag file, the <tag-file> element of the TLD file stored in the library JAR will be ignored. Therefore, considering that the tag file does not exist, a translation error occurs during JSP translation.

(2) When compiling JSP using the cjjspc command

By specifying the tag library that exists within the JAR file in the class path with the -classpath option of the cjjspc command, you can use the tag library deployed outside the WEB-INF/lib directory of the Web application from JSP.

(a) Searching the TLD file

The TLD file included in the JAR file specified in the class path is searched automatically and URI specified in the <uri> element of the TLD file and the TLD file are mapped.

The mapping of the TLD file in the JAR file specified in the class path has the lowest priority level. Therefore, even if the URI of the TLD file within a JAR file specified in the class path is duplicated with another TLD file and web.xml in the mapping of the URI and TLD file, this does not affect the operations of the J2EE applications running with the versions prior to the 07-60 version. For details on the priority levels for the mapping of the TLD file within the JAR file specified in a class path, see 6.2.6(7) Mapping of URI and TLD files specified in the uri attribute of the taglib directive.

(b) Tag library functionality that can be used when storing the tag library in the JAR file specified in the class path

The tag library functionality that you can use for storing the tag library in the JAR file specified in the class path are the custom tag and the listener.

You cannot use a tag file. If you use a tag file stored in the JAR file specified in the class path for a JSP file or a tag file, the <tag-file> element of the TLD file stored in the JAR file will be ignored. Therefore, considering that the tag file does not exist, a translation error occurs during the JSP translation.