用System.out.println();检测那个对象是空的,你没有代码,只有这样了
解决方案 »
- red5 录像和播放问题
- 有个JS问题!请高手帮忙下!!
- hibernate 基础问题!在线等。。。。。
- 发生在我同学的同学身边的事。。太黑暗了,请求管理员保护好这帖子啊
- struct
- 请高手指点关于添加一行记录的问题
- 能不能在jsp页面刚打开的时候就调用一个servlet,而不是在jsp页面中单击某个连接调用
- 能用javascript设置ie窗口的大小以及不显示菜单等内容吗?
- 对设计模式(mvc)感兴趣的朋友请进,交流一下
- 加入iframe后form表单找不到action了
- struts2.0 .11 FCKeditor2.3 配置
- hibernate3.0+spring2.0连接数据库警告
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;import com.dareway.apps.common.GlobalNames;public class EncodingFilter
implements Filter
{ protected String encoding;
protected FilterConfig filterConfig; public EncodingFilter()
{
encoding = null;
filterConfig = null;
} public void destroy()
{
encoding = null;
filterConfig = null;
} public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
if(encoding != null){
String contentType = request.getContentType();
if(contentType != null){
String[] contentTypeTem = contentType.split(";");
contentTypeTem = contentTypeTem[contentTypeTem.length-1].split("=");
if(contentTypeTem.length == 2 && "UTF-8".equalsIgnoreCase(contentTypeTem[1])){
request.setCharacterEncoding("UTF-8");
}else {
request.setCharacterEncoding(encoding);
}
}else {
request.setCharacterEncoding(encoding);
}
}else{
request.setCharacterEncoding(GlobalNames.DEFAULT_ENCODING);
}
chain.doFilter(request, response);
} public void init(FilterConfig filterConfig)
throws ServletException
{
this.filterConfig = filterConfig;
encoding = filterConfig.getInitParameter(GlobalNames.ENCODING);
}
}这是EncodingFilter的代码?
异常发生在chain.doFilter(request, response);
这个地方。
第二:
这是dofilter的内容,每个请求都会走这一步的。web.xml中的配置
<filter>
<filter-name>Encoding</filter-name>
<filter-class>com.dareway.apps.common.webcontroller.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
而且点按钮是不固定的 有时候是这个按钮,有时候是另外一个。而且就算某一个按钮报了异常,然后重新点击时异常就不会出现了。