To globally enable JSP caching, set the jspCachingEnabled property to true. The default is false. For example:
asadmin set server-config.web-container.property.jspCachingEnabled="true" |
For more information about the asadmin set command, see the Oracle GlassFish Server 3.0.1 Reference Manual.
To enable JSP caching for a single web application, follow these steps:
Extract the META-INF/appserv-tags.tld file from the as-install/glassfish/modules/web-glue.jar file.
Create a new JAR file (for example, appserv-tags.jar) containing just the META-INF/appserv-tags.tld file previously extracted.
Bundle this new JAR file in the WEB-INF/lib directory of your web application.
Web applications that use JSP caching without bundling the tag library are not portable.
Refer to GlassFish Server tags in JSP files as follows:
<%@ taglib prefix="prefix" uri="Sun ONE Application Server Tags" %>
Subsequently, the cache tags are available as <prefix:cache> and <prefix:flush>. For example, if your prefix is mypfx, the cache tags are available as <mypfx:cache> and <mypfx:flush>.