当前位置:编程学习 > JS >>

Jsp&Servelet学习笔记(5)

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>
补充:Web开发 , Jsp ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,