1.5創建一個部署描述文件
·為你的servlets注冊並且創建一個url mapping
·注冊並指定應用中的監聽器和過濾器
·指定上下文中的初始化參數。
·配置錯誤頁,和歡迎頁
·配置seeion 超時
<?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>