2023-02-25 401
web.xml做了如下几件事情
1. 指定spring的配置文件有两个
1 applicationContext.xml: 用于链接数据库的
2 applicationContext-shiro.xml: 用于配置shiro的
2. 指定springmvc的配置文件
1 springMVC.xml
3. 使用shiro过滤器
1 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3 xmlns="http://java.sun.com/xml/ns/javaee"
4 xmlns:web="http://java.sun.com/xml/ns/javaee"
5 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
6
7 <!-- spring的配置文件-->
8 <context-param>
9 <param-name>contextConfigLocation</param-name>
10 <param-value>
11 classpath:applicationContext.xml,
12 classpath:applicationContext-shiro.xml
13 </param-value>
14 </context-param>
15 <listener>
16 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
17 </listener>
18
19 <!-- spring mvc核心:分发servlet -->
20 <servlet>
21 <servlet-name>mvc-dispatcher</servlet-name>
22 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
23 <!-- spring mvc的配置文件 -->
24 <init-param>
25 <param-name>contextConfigLocation</param-name>
26 <param-value>classpath:springMVC.xml</param-value>
27 </init-param>
28 <load-on-startup>1</load-on-startup>
29 </servlet>
30 <servlet-mapping>
31 <servlet-name>mvc-dispatcher</servlet-name>
32 <url-pattern>/</url-pattern>
33 </servlet-mapping>
34
35 <!-- Shiro配置 -->
36 <filter>
37 <filter-name>shiroFilter</filter-name>
38 <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
39 <init-param>
40 <param-name>targetFilterLifecycle</param-name>
41 <param-value>true</param-value>
42 </init-param>
43 </filter>
44 <filter-mapping>
45 <filter-name>shiroFilter</filter-name>
46 <url-pattern>/*</url-pattern>
47 </filter-mapping>
48
49 </web-app>
点击展开
原文链接:https://77isp.com/post/34309.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态