Deployment Descriptor

The deployment descriptor describes the web appliction to the servlet container.

Among the items described here are:

  • The applicaion name and description.
  • The fact that the application is distributable.
  • Parameters for the application
  • A servlet, along with its name and class.
  • The servlet's initialization parameters.
  • An application event listerner class.
  • Error pages for specific exceptions or errors.
Other items we might describe are:
  • URL-to-Servlet mappings.
  • Session timeout period.
  • security constraints.
  • JSP custom tag libraries.
  • Welcome files.
  • Filter definitions and mappings.
  • MIME type mappings.
  • JNDI names.
<?xml version="1.0" encoding="ISO-8859-1"?>

<!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>Test Webapp</display-name>
    <description>Strictly for testing</description>
    <distributable/>
    <context-param>
        <param-name>DBName</param-name>
        <param-value>MySQL</param-value>
    </context-param>
    <servlet>
        <servlet-name>test_web_app</servlet-name>
        <servlet-class>TestServlet</servlet-class>
        <init-param>
            <param-name>datafile</param-name>
            <param-value>test_data.ser</param-value>
        </init-param>
    </servlet>
    <listener>
        <listener-class>com.grdurand.MyListener</listener-class>
    </listener>
    <error-page>
        <exception-type>java.sql.SQLException</exception-type>
        <location>/errorpages/sql_error.html</location>
    </error-page>
</web-app>