Tutorial: Understanding the New Features of TLD Caching in JSPs
TLD Caching and Well-Known Tag
Library Locations
As an extension
of standard JSP "well-known URI" functionality described in the JSP specification,
the OC4J JSP container supports the use of one or more directories, known as
well-known tag library locations, where you can place tag library JAR
files to be shared across multiple Web applications.
Beginning with
the OC4J 9.0.4 implementation, there is also a persistent caching feature for
TLD files, with a global cache for TLD files in any well-known tag library locations,
as well as an application-level cache for any application that uses TLD caching.
TLD caching is enabled or disabled through the jsp-cache-tlds
attribute of the <orion-web-app> element, at a global level
through this attribute in the global-web-application.xml file, or
at an application level through this attribute in the application orion-web.xml
file.
By default, TLD caching is enabled at a global level through
the default setting jsp-cache-tlds="true" in global-web-application.xml.
This is also the default setting in the orion-web.xml file of each
application.
If TLD caching is enabled, you can specify one or more well-known
tag library locations using a semicolon-delimited list of directory paths in
the jsp-taglib-locations attribute of the <orion-web-app>
element in global-web-application.xml. See "OC4J
Configuration Parameters for JSP" for additional information about
this attribute.
Disabling TLD Caching
As mentioned above, by default, TLD caching is enabled at a global level through
the default setting jsp-cache-tlds="true" in global-web-application.xml.
This is also the default setting in the orion-web.xml file of each
application, but you can disable TLD caching for any particular application
with a setting of jsp-cache-tlds="false" in orion-web.xml.
This overrides the global setting.
Alternatively, you can disable TLD caching at a global level
with a "false" setting in global-web-application.xml,
then optionally enable TLD caching for any particular application with a "true"
setting in orion-web.xml.
If TLD caching is disabled, the well-known tag library
location is limited to a single directory, using functionality that existed prior
to the availability of TLD caching. In this case, the well-known location is determined
by the well_known_taglib_loc JSP configuration parameter. See "JSP
Configuration Parameters" for additional information about this parameter.
In an Oracle Application Server environment, the default well-known
location is ORACLE_HOME/j2ee/home/jsp/lib/taglib (assuming ORACLE_HOME
is defined).
Important Points to take care of
By default, orion-web.xml inherits its jsp-cache-tlds
setting from global-web-application.xml.
Use the jsp-taglib-locations attribute only
in global-web-application.xml, not in orion-web.xml.
For any application to pick up files in the well-known
location or locations, the directory or directories that are specified in
jsp-taglib-locations or the directory that is specified in
well_known_taglib_loc must be added to the path attribute setting
of the <library> element in the OC4J global application.xml
file in the configuration files directory (j2ee/home/config by default in
OC4J standalone). See the Oracle
Application Server Containers for J2EE User's Guide for information
about application.xml.
If a TLD file is present both in the well-known location
and under the /WEB-INF directory of an application, the /WEB-INF copy takes
precedence and is used.
If TLD files with the same URI value are present
in or under the /WEB-INF directory and also in a JAR file in the /WEB-INF/lib
directory, the decision of which one to use is indeterminate. Avoid this situation.