ssm整合之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" 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>crm32</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>
<!-- 配置spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/applicationContext-*.xml</param-value>
</context-param>
<!-- 配置監(jiān)聽器加載spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置過濾器,解決post的亂碼問題 -->
<filter>
<filter-name>encoding</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>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置SpringMVC -->
<servlet>
<servlet-name>boot-crm</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/springmvc.xml</param-value>
</init-param>
<!-- 配置springmvc什么時(shí)候啟動(dòng),參數(shù)必須為整數(shù) -->
<!-- 如果為0或者大于0,則springMVC隨著容器啟動(dòng)而啟動(dòng) -->
<!-- 如果小于0,則在第一次請(qǐng)求進(jìn)來的時(shí)候啟動(dòng) -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>boot-crm</servlet-name>
<!-- 所有的請(qǐng)求都進(jìn)入springMVC -->
<url-pattern>/</url-pattern>
<!--特別注意!!!
攔截/*,這是一個(gè)錯(cuò)誤的方式,請(qǐng)求可以走到Action中,但轉(zhuǎn)到j(luò)sp時(shí)再次被攔截,不能訪問到j(luò)sp,千萬千萬不能寫攔截/*-->
</servlet-mapping>
</web-app>
轉(zhuǎn)載于:https://www.cnblogs.com/zjj1996/p/9100658.html
總結(jié)
以上是生活随笔為你收集整理的ssm整合之web.xml配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SP2916 GSS5 - Can yo
- 下一篇: CODE[VS] 2824 盗窃-大海的