myeclipse配置struts+hibernate的问题 javax.servlet.ServletException: java.lang.NullPointerException
javax.servlet.ServletException:java.lang.NullPointerExceptionorg.apache.struts.action...
javax.servlet.ServletException: java.lang.NullPointerException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.struts.filter.MyFilter.doFilter(MyFilter.java:15)
package com.struts.filter;
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;
public class MyFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("gb2312"); //设置request的编码格式
response.setCharacterEncoding("gb2312"); //设置response的编码格式
chain.doFilter(request, response); //调用FilterChain对象的doFilter()方法
---------------------------------------出错的第15行
}
public void init(FilterConfig arg0) throws ServletException {
} //该方法体为空
public void destroy() { //destroy()此方法体为空
}
} 展开
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.struts.filter.MyFilter.doFilter(MyFilter.java:15)
package com.struts.filter;
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;
public class MyFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("gb2312"); //设置request的编码格式
response.setCharacterEncoding("gb2312"); //设置response的编码格式
chain.doFilter(request, response); //调用FilterChain对象的doFilter()方法
---------------------------------------出错的第15行
}
public void init(FilterConfig arg0) throws ServletException {
} //该方法体为空
public void destroy() { //destroy()此方法体为空
}
} 展开
4个回答
展开全部
是你的MyFilter中的第15行有问题,你没有完整的代码我也不知到具体错在哪里。在doFilter()这个方法里面
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
javax.servlet.ServletException: java.lang.NullPointerException
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Servlet空指针异常,原因有很多,你这样只把异常贴出来,别人很难回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
空指针异常有什么问题吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询