在.web.xml中写入下面代码:
encode
com.cnnic.struts.EncodingFilter
encode
/*
在类中写入
package com.cnnic.struts;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
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);
}
public void destroy(){
}
}
阅读(1341) | 评论(0) | 转发(0) |