SSM configuration files in web.xml

<! - core listeners 
create spring factory class object when tomcat (web container, application server, web server) starts when bound to the tomcat context
->
<listener>
<listener-class> org.springframework.web .context.ContextLoaderListener </ listener-class>
</ listener>

<-! manually specify the location and name of the spring main configuration file ->

<context-param>
<param-name> the contextConfigLocation </ param-name>
<param -value> CLASSPATH: spring.xml </ param-value>
</ context-param>


! <- Spring interception request to the front end of the controller spring mvc process ->
<the servlet>
<the servlet-name> Spring-MVC </ the servlet-name>
<the servlet-class> ORG.springframework.web.servlet.DispatcherServlet</servlet-class>

<! - the location and name of the main spring mvc configuration file ->

<the init-param>
<param-name> the contextConfigLocation </ param-name>
<param-value> CLASSPATH: Spring-mvc.xml </ param- value>
</ the init-param>

</ the servlet>

<the servlet-Mapping>
<the servlet-name> Spring-MVC </ the servlet-name>
<URL-pattern> *. do </ URL-pattern>
</ the servlet-Mapping >


<! - the filter arranged solve Chinese garbled post request ->

<filter>
<filter-name> EncodingFilter </ filter-name>
<filter-class> org.springframework.web.filter.CharacterEncodingFilter </ filter the -class>
<the init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceRespanseEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Guess you like

Origin www.cnblogs.com/LFY001023/p/10966722.html