2009-09-26

Tomcat configuration file - web.xml

Tomcat configuration file (web.xml) is using XML pattern, which the global configuration file is within tomcat\conf directory, and individual configuration file is within tomcat\wepapps\webdir\WEB-INF directory. User can always refer to the global configuration file as a sample to set the individual configuration file. The parent node of web.xml is <web-app> and below is the common nodes that can be used:

  1. Description for the web application.
    <description>
    Description for Web Application
    </description>
  2. Map the servlet to associate class and URL pattern.
    <servlet>
    <servlet-name>servlet name</servlet-name>
    <servlet-class>class name</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>servlet name</servlet-name>
    <url-pattern>url pattern</url-pattern>
    </servlet-mapping>

  3. Map the taglib to associate TLD files.
    <taglib>
    <taglib-uri>
    http://www.gnokproject.com/taglibs/taglib-v1.0
    </taglib-uri>
    <taglib-location>
    /WEB-INF/jsp/taglib.tld
    </taglib-location>
    </taglib>
  4. Map extension to associate mime type.
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>

  5. Session timeout.
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
  6. First file to be accessed.
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>

1 comments:

Anonymous said...

Hi,

Very interesting. Nice article and discussion.
Thanks a lot for same.

Regards,
Gitesh Trivedi
http://www.dbametrix.com