hooyantsing's Blog

Web-xml_配置文件

字数统计: 530阅读时长: 3 min
2019/11/17

Web.xml 配置文件

路径:Webcontent / WEB-INF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?xml version="1.0" encoding="UTF-8"?>
<web-app  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns="http://xmlns.jcp.org/xml/ns/javaee"  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee  http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<!-- 默认服务器首页 -->
   <display-name>191026_Servlet</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
     <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
<!-- JNDI 连接池 -->
  <resource-ref>
    <description>大麦数据库连接</description>
    <res-ref-name>mysql/damai</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
<!-- 在web文件中设置servlet文件地址 -->
  <servlet>
    <servlet-name>hello world  servlet</servlet-name>
     <servlet-class>com.yc.damai.servlet.HelloServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>hello world  servlet</servlet-name>
    <url-pattern>/hello.s</url-pattern>
  </servlet-mapping>
<!-- 在web文件中设置servlet文件增加参数 -->
  <servlet>
    <servlet-name>登录的servlet</servlet-name>
     <servlet-class>com.yc.damai.servlet.LoginServlet</servlet-class>
    <init-param>
      <param-name>begin-time</param-name>
      <param-value>8</param-value>
    </init-param>
    <init-param>
      <param-name>end-time</param-name>
      <param-value>24</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>登录的servlet</servlet-name>
     <url-pattern>/LoginServlet.s</url-pattern>
  </servlet-mapping>
<!-- 过滤器 -->
  <filter>
    <filter-name>权限访问控制过滤器</filter-name>
     <filter-class>com.yc.damai.servlet.LoginFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>权限访问控制过滤器</filter-name>
    <url-pattern>/cart.s</url-pattern>
    <url-pattern>/cart.jsp</url-pattern>
    <url-pattern>/olist.jsp</url-pattern>
  </filter-mapping>
</web-app>
CATALOG