贴filter代码看看
package com.qdu.com; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; public class FormFilter implements Filter{ class Request extends HttpServletRequestWrapper{ public Request(HttpServletRequest request){ super(request); } public String toChi(String input){ try{ byte[] bytes = input.getBytes("ISO8859-1"); return new String(bytes, "GBK"); }catch(Exception ex){ } return null; } private HttpServletRequest getHttpServletRequest(){ return (HttpServletRequest)super.getRequest(); } public String getParameter(String name){ return toChi(getHttpServletRequest().getParameter(name)); } public String[] getParameterValues(String name){ String values[] = getHttpServletRequest().getParameterValues(name); if(values != null){ for(int i= 0; i<values.length; i++){ values[i] = toChi(values[i]); } } return null; } } public void destroy(){ } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException{ HttpServletRequest httpreq = (HttpServletRequest)request; if(httpreq.getMethod().equals("POST")){ request.setCharacterEncoding("GBK"); }else{ request = new Request(httpreq); } chain.doFilter(request, response); } public void init(FilterConfig filterConfig)throws ServletException{ } }
@SharpeyeKardel: 应该是你自己实现的request的事,如果你用POST请求那个URL也是返回空白页的话就能确定