This method ensures that no garbled characters are generated in Tomcat and weblogic.
1. <connector Port = "8080" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443"Uriencoding = "UTF-8 "/>
Change Tomcat encoding, Tomcat is iso-8859-1 by default
2. Configure spring encoding in Web. xml
<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>
3. jsp
Encodeuri (URL)
4. Action:
CompanyName = java.net. urldecoder. Decode (request. getparameter ("companyName"), "UTF-8 ");
Or directly obtain
CompanyName = request. getparameter ("companyName ");
In this way, the deployment to WebLogic does not contain garbled characters, and you do not need to set the encoding in the filter.
Release to WebLogic put the spring configuration file under/WEB-INF/, otherwise it will not be found