MyRequestProcessor.java
上传用户:jishiqi_cj
上传日期:2022-08-08
资源大小:24765k
文件大小:1k
源码类别:

Java编程

开发平台:

Java

  1. package StudyNote;
  2. import javax.servlet.http.HttpServlet;
  3. import javax.servlet.http.HttpServletRequest;
  4. import javax.servlet.http.HttpServletResponse;
  5. import org.apache.struts.action.RequestProcessor;
  6. import org.apache.struts.config.ForwardConfig;
  7. import org.apache.commons.logging.Log;
  8. public class MyRequestProcessor extends RequestProcessor {
  9. public MyRequestProcessor() {}
  10. protected boolean processPreprocess( HttpServletRequest request,
  11.                                      HttpServletResponse response ){
  12.  
  13.  try{
  14.    request.setCharacterEncoding("gb2312");
  15.  }
  16.  catch(Exception ex){
  17. System.out.println("字符集设置失败");
  18.  
  19.  }
  20.  
  21.  return true;
  22. }
  23. }