spring mvc 配置
来源:互联网 发布:java找不到或无法加载 编辑:程序博客网 时间:2024/06/02 07:58
web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <!-- --> <display-name>MyProject</display-name> <welcome-file-list> <welcome-file>login.html</welcome-file> </welcome-file-list> <!-- 加载其他配置信息 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:config/spring-*.xml</param-value> </context-param> <context-param> <param-name>webAppRootKey</param-name> <param-value>test_ssh.root</param-value> </context-param> <!-- 加载日志文件 --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>WEB-INF/log4j.properties</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>60000</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <!-- 配置Spring监听器 --> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- 配置Shiro过滤器,先让Shiro过滤系统接收到的请求 --> <!-- 这里filter-name必须对应applicationContext.xml中定义的<bean id="shiroFilter"/> --> <!-- 使用[/*]匹配所有请求,保证所有的可控请求都经过Shiro的过滤 --> <!-- 通常会将此filter-mapping放置到最前面(即其他filter-mapping前面),以保证它是过滤器链中第一个起作用的 --> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 配置Spring字符编码过滤器 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 配置spring支持 hibernate 延迟加载 --> <filter> <filter-name>openSession</filter-name> <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>openSession</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- SpringMVC核心分发器 --> <servlet> <servlet-name>springMVC</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <!-- 配置加载相应的文件 --> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:config/spring/springMVC-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springMVC</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.png</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping> <!-- 为Druid监控配置访问权限--> <filter> <filter-name>DruidWebStatFilter</filter-name> <filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class> <init-param> <param-name>exclusions</param-name> <param-value>/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,*.html,/druid/*</param-value> </init-param> </filter> <filter-mapping> <filter-name>DruidWebStatFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>DruidStatView</servlet-name> <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>DruidStatView</servlet-name> <url-pattern>/druid/*</url-pattern> </servlet-mapping> <error-page> <error-code>404</error-code> <location>/errors/404.jsp</location> </error-page> <error-page> <error-code>403</error-code> <location>/errors/403.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/errors/500.jsp</location> </error-page> <error-page> <error-code>503</error-code> <location>/errors/503.jsp</location> </error-page> <!-- 设置浏览器回话超时时间 --> <session-config> <session-timeout>720</session-timeout> </session-config>
</web-app>
0 0
- 【spring mvc】spring-mvc配置
- Spring MVC 配置
- Spring MVC 配置--解剖
- spring web mvc配置
- Spring MVC 相关配置
- Spring MVC 配置
- Spring MVC国际化配置
- Spring MVC 配置--解剖
- Spring MVC 配置
- Spring MVC配置(一)
- Spring MVC配置(二)
- Spring MVC配置(三)
- Spring MVC配置(四)
- Spring MVC国际化配置
- spring mvc 基本配置
- Spring MVC配置
- spring mvc注解配置
- Spring MVC配置
- select嵌套,可以使用父select的每行做判断
- webstorm配置markdown编辑器
- lodash 中文学习拾零之 Object篇
- TWebbrower禁止弹出窗口
- C++primer阅读笔记-重载运算与类型转换(可调用对象与function)
- spring mvc 配置
- [你必须知道的异步编程]——异步编程模型(APM)
- domino应用的困惑
- c++的构造函数与析构函数区别和使用析构函数的注意事项g
- UC/OS II 任务管理(5)之任务删除、阻塞和恢复
- 自学QT之实现一个用户信息窗口
- js window.open 打开页面并居中
- 文法相关
- Circle vs Triangle(DFS+博弈)