加上此段代码,再也不用担心乱码问题了!只要在web.xml文件中添加上相应的过滤器即可实现。
查看代码:- public class AllCharacterEncoding implements Filter {
- private FilterConfig filterconfig;
- private String defaultencoding="UTF-8";
- public void init(FilterConfig filterconfig) throws ServletException {
- this.filterconfig=filterconfig;
- }
- public void doFilter(ServletRequest req, ServletResponse resp,
- FilterChain chain) throws IOException, ServletException {
-
复制代码 |
|