Jsp&Servelet学习笔记(5)
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 17:13 点击:次
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>
·为你的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>
- 发表评论
-
- 最新评论 更多>>