Jsp&Servelet study notes (5)
Author:Eve Cole
Update Time:2009-07-02 17:15:03
1.5 Create a deployment descriptor file
·Register and create a url mapping for your servlets
· Register and specify listeners and filters in the application · Specify initialization parameters in the context.
·Configure error page and welcome page ·Configure seeion timeout
<?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-application_2_3.dtd ">
<web-app>
<display-name>Servlet 2.3 deployment descriptor</display-name>
<filter>
<filter-name>RequestFilter</filter-name>
<filter-class>com.mydev.RequestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RequestFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.mydev.ReqListener</listener-class>
</listener>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.mydev.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> MyServlet </servlet-name>
<url-pattern>/myservlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>15</session-timeout>
</session-config> <error-page>
<error-code>404</error-code>
<location>/err404.jsp</location>
</error-page>
</web-app>
http://blog.csdn.net/bruceleey/archive/2007/02/07/1503854.aspx