Sun Java System Web Server 6.1 SP12 Programmer's Guide to Web Applications

Sample web.xml File

The following is a sample web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!--
     Copyright 2002 Sun Microsystems, Inc. All rights reserved.
-->
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web 
     Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>

<web-app>
      <display-name>i18n-simple</display-name>
      <distributable></distributable>
      <filter>
            <filter-name>Simple Filter</filter-name>
            <filter-class>samples.i18n.simple.servlet.SimpleFilter
            </filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
             </init-param>
             <init-param>
                 <param-name>usefilter</param-name>
                 <param-value>true</param-value>
               </init-param>
      </filter>
      <filter-mapping>
          <filter-name>Simple Filter</filter-name>
          <url-pattern>/SimpleFilterServlet</url-pattern>
    </filter-mapping>
    <servlet>
         <servlet-name>SimpleI18nServlet</servlet-name>
         <servlet-class>samples.i18n.simple.servlet.SimpleI18nServlet
         </servlet-class>
         <load-on-startup>0</load-on-startup>
     </servlet>
     <servlet>
         <servlet-name>IncludedServlet</servlet-name>
         <servlet-class>samples.i18n.simple.servlet.IncludedServlet
         </servlet-class>
     </servlet>
     <servlet>
         <servlet-name>ForwardedServlet</servlet-name>
         <servlet-class>samples.i18n.simple.servlet.ForwardedServlet
         </servlet-class>
     </servlet>
     <servlet>
       <servlet-name>SimpleFilterServlet</servlet-name>
       <servlet-class>samples.i18n.simple.servlet.SimpleFilterServlet
       </servlet-class>
  </servlet>
  <servlet>
    <servlet-name>LocaleCharsetServlet</servlet-name>
    <servlet-class>samples.i18n.simple.servlet.LocaleCharsetServlet
    </servlet-class>
  </servlet>
  <servlet-mapping>
       <servlet-name>SimpleI18nServlet</servlet-name>
       <url-pattern>/SimpleI18nServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
           <servlet-name>IncludedServlet</servlet-name>
           <url-pattern>/IncludedServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
           <servlet-name>ForwardedServlet</servlet-name>
           <url-pattern>/ForwardedServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
           <servlet-name>SimpleFilterServlet</servlet-name>
           <url-pattern>/SimpleFilterServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
                <servlet-name>LocaleCharsetServlet</servlet-name>
                <url-pattern>/LocaleCharsetServlet</url-pattern>
  </servlet-mapping>
  <taglib>
                   <taglib-uri>/i18ntaglib</taglib-uri>
                   <taglib-location>/WEB-INF/tlds/i18ntaglib.tld
                   </taglib-location>
  </taglib>
</web-app>