提交 663eed3e 编写于 作者: M megagao

修改了web.xml的xmlns

上级 7f16d22e
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"
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">
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" <display-name>production_ssm</display-name>
id="WebApp_ID" version="2.5"> <context-param>
<display-name>production_ms</display-name> <param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext-*.xml</param-value>
<!-- 配置spring容器监听器 --> </context-param>
<context-param> <listener>
<param-name>contextConfigLocation</param-name> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<param-value>classpath:spring/applicationContext-*.xml</param-value> </listener>
</context-param> <servlet>
<listener> <servlet-name>springmvc</servlet-name>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</listener> <init-param>
<param-name>contextConfigLocation</param-name>
<!-- 加载springMVC servlet, 配置前端控制器 --> <param-value>classpath:spring/springmvc-servlet.xml</param-value>
<servlet> </init-param>
<servlet-name>springmvc</servlet-name> </servlet>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <servlet-mapping>
<!-- 加载springmvc配置 --> <servlet-name>springmvc</servlet-name>
<init-param> <url-pattern>/</url-pattern>
<param-name>contextConfigLocation</param-name> </servlet-mapping>
<!-- 配置文件的地址 如果不配置contextConfigLocation,默认查找的配置文件为classpath下的:servlet名称+"-serlvet.xml" <filter>
即:springmvc-serlvet.xml --> <filter-name>shiroFilter</filter-name>
<param-value>classpath:spring/springmvc-servlet.xml</param-value> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</init-param> <init-param>
</servlet> <param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
<servlet-mapping> </init-param>
<servlet-name>springmvc</servlet-name> </filter>
<!-- 可以配置/ ,此工程 所有请求全部由springmvc解析,此种方式可以实现 RESTful方式,需要特殊处理对静态文件的解析不能由 <filter-mapping>
springmvc解析 可以配置*.do或*.action,所有请求的url扩展名为.do或.action由springmvc解析,此种方法常用 不可以/*, <filter-name>shiroFilter</filter-name>
如果配置/*,返回jsp也由springmvc解析,这是不对的。 --> <url-pattern>/*</url-pattern>
<url-pattern>/</url-pattern> </filter-mapping>
</servlet-mapping> <filter>
<filter-name>CharacterEncodingFilter</filter-name>
<!-- shiro的filter --> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<!-- shiro过虑器,DelegatingFilterProxy通过代理模式将spring容器中的bean和filter关联起来 --> <init-param>
<filter> <param-name>encoding</param-name>
<filter-name>shiroFilter</filter-name> <param-value>utf-8</param-value>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </init-param>
<!-- 设置true由servlet容器控制filter的生命周期 --> </filter>
<init-param> <filter-mapping>
<param-name>targetFilterLifecycle</param-name> <filter-name>CharacterEncodingFilter</filter-name>
<param-value>true</param-value> <url-pattern>/*</url-pattern>
</init-param> </filter-mapping>
<!-- 设置spring容器filter的bean id,如果不设置则找与filter-name一致的bean--> <error-page>
<!--<init-param> <exception-type>java.lang.Throwable</exception-type>
<param-name>targetBeanName</param-name> <location>/500.jsp</location>
<param-value>shiroFilter</param-value> </error-page>
</init-param>--> <error-page>
</filter> <error-code>500</error-code>
<filter-mapping> <location>/500.jsp</location>
<filter-name>shiroFilter</filter-name> </error-page>
<url-pattern>/*</url-pattern> <error-page>
</filter-mapping> <error-code>404</error-code>
<location>/404.jsp</location>
<!-- post乱码处理 --> </error-page>
<filter>
<filter-name>CharacterEncodingFilter</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>
</filter>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 出错页面定义 -->
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/500.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/500.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
</web-app> </web-app>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册