您的位置:首页 > 其它

使用ssm框架在web.xml中的基本配置信息

2017-11-07 10:10 459 查看
<?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" version="2.5">
<display-name>CRM_11</display-name>
<!--使用的tomcat服务器进行session复制 -->
<distributable />

<!--Spring配置文件信息 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!--springMVC配置文件信息 -->
<servlet>
<servlet-name>crm_11</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:context-dispathcer.xml</param-value>
</init-param>
<!-- 启用即加载 -->
<load-on-startup>1</load-on-startup>
</servlet>

<!-- encodeing编码 -->
<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>
 
<!-- 请求后缀拦截,do结尾的请求是用于后台管理系统,htm结尾的请求,用于前端界面请求 -->
<servlet-mapping>
<servlet-name>crm_11</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<!-- 404、500 -->
<error-page>
<error-code>404</error-code>
<location>/404.do</location><!-- 页面跳转地址 -->
</error-page>

<error-page>
<error-code>500</error-code>
<location>/500.do</location><!-- 页面跳转地址 -->
</error-page>

<!-- session有效期 -->
<session-config>
<session-timeout>120</session-timeout><!-- 默认分钟 -->
</session-config>

</web-app>  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: