This section includes sample web.xml and sun-web.xml files
The following is the sample web.xml file.
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.5">- <!-- Copyright 2006 Sun Microsystems, Inc. All rights reserved. --> - <web-app> <display-name>webapps-caching</display-name> - <servlet> <servlet-name>ServCache</servlet-name> <servlet-class>samples.webapps.caching.ServCache</servlet-class> <load-on-startup>0</load-on-startup> </servlet> - <servlet-mapping> <servlet-name>ServCache</servlet-name> <url-pattern>/ServCache</url-pattern> </servlet-mapping> - <session-config> <session-timeout>30</session-timeout> </session-config> - <taglib> <taglib-uri>/com/sun/web/taglibs/cache</taglib-uri> <taglib-location>/WEB-INF/sun-web-cache.tld</taglib-location> </taglib> </web-app>
The following example shows a sample sun-web.xml file.
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd"> <!-- Copyright 2006 Sun Microsystems, Inc. All rights reserved. --> - <sun-web-app> - <session-config> <session-manager/> </session-config> - <cache enabled="true" timeout-in-seconds="300"> - <cache-mapping> <servlet-name>ServCache</servlet-name> <key-field name="inputtext" scope="request.parameter"/> - <constraint-field name="inputtext" scope="request.parameter"> <value>one</value> <value>two</value> </constraint-field> </cache-mapping> </cache> </sun-web-app>