<? XML version = "1.0" encoding = "UTF-8"?>
<Web-app xmlns = "http://java.sun.com/xml/ns/javaee"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" version = "2.5"
Xsi: schemalocation = "http://java.sun.com/xml/ns/javaee
Http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd>
<Filter>
// Use spring characterencodingfilter
<Filter-Name> encodingfilter </filter-Name>
<Filter-class>
Org. springframework. Web. Filter. characterencodingfilter
</Filter-class>
<Init-param>
<Param-Name> encoding </param-Name>
// The UTF-8 encoding is used after the filter is filtered.
<Param-value> UTF-8 </param-value>
</Init-param>
</Filter>
<Filter-mapping>
// Filter all paths:/* indicates all paths
<Filter-Name> encodingfilter </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>
<Servlet>
<Servlet-Name> action </servlet-Name>
// Actionservlet in struts. All request responses are handled by actionservlet
<Servlet-class>
Org. Apache. Struts. Action. actionservlet
</Servlet-class>
<Init-param>
// Location of the configuration file in struts
<Param-Name> config </param-Name>
<Param-value>/WEB-INF/struts-config.xml </param-value>
</Init-param>
<Init-param>
<Param-Name> debug </param-Name>
<Param-value> 3 </param-value>
</Init-param>
<Init-param>
<Param-Name> detail </param-Name>
<Param-value> 3 </param-value>
</Init-param>
<Load-on-startup> 0 </load-on-startup>
</Servlet>
<Servlet-mapping>
// Name of the mapped suffix Extension
<Servlet-Name> action </servlet-Name>
<URL-pattern> *. DO </url-pattern>
</Servlet-mapping>
<Welcome-file-List>
<Welcome-File> index. jsp </welcome-File>
</Welcome-file-List>
</Web-app>
The Org. springframework. Web. Filter. characterencodingfilter class is unique to spring and specifically solves the problem of UTF-8 garbled Chinese Web.