|
Compile this class
package com.group;
import java.io. *;
import javax.servlet. *;
import javax.servlet.http. *;
public class EncodingFilter implements Filter {
public void init (FilterConfig filterConfig)
throws ServletException {
}
public void doFilter (ServletRequest request,
ServletResponse response,
FilterChain chain)
throws java.io.IOException, ServletException {
request.setCharacterEncoding ("GBK");
chain.doFilter (request, response);
}
Ranch
public void destroy () {
}
}
Then add it in web-xml
<filter>
<filter-name> encode </ filter-name>
<filter-class> com.group.EncodingFilter </ filter-class>
</ filter>
<filter-mapping>
<filter-name> encode </ filter-name>
<url-pattern> / * </ url-pattern>
</ filter-mapping>
In this way, you can wait until the encoding set becomes Chinese, which should solve your problem |
|