【Java开源代码栏目提醒】:网学会员为需要Java开源代码的朋友们搜集整理了ActionServlet.java相关资料,希望对各位网友有所帮助!
/*
* Created on 2006-1-22
*
*/
package com.bOS.Action;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author BWeiMing
*
*/
public class ActionServlet extends org.apache.struts.action.ActionServlet {
protected void process(HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse) throws IOException,ServletException {
setCharset(httpservletrequest);
super.process(httpservletrequest, httpservletresponse);
}
private void setCharset(HttpServletRequest httpservletrequest) {
String s = getServletConfig().getInitParameter("charset");
if (s == null || s.length() == 0) {
s="GBK";
}
try {
httpservletrequest.setCharacterEncoding(s);
} catch (UnsupportedEncodingException unsupportedencodingexception) {
log("set character encoding error", unsupportedencodingexception);
}
}
}