JSP程序出现下面错误,求高手指点!
typeExceptionreportmessagedescriptionTheserverencounteredaninternalerror()thatprevent...
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:500)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.servlet.HelpAddUser.doPost(HelpAddUser.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
org.apache.jsp.admin_jsp._jspService(admin_jsp.java:74)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.servlet.HelpAddUser.doPost(HelpAddUser.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.30 logs.
源代码:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("gb2312");// 设置字符的编码格式为gb2312
String logname=(String)req.getParameter("logname");
String password=(String)req.getParameter("password");
User user=new User();
user.setLogname(logname);
user.setPassword(password);
UserDao userDao=new UserDao();
try{
userDao.saveUser(user);
}catch(Exception e){
e.printStackTrace();
}
RequestDispatcher rd=req.getRequestDispatcher("admin.jsp");
rd.forward(req,resp);
} 展开
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:500)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.servlet.HelpAddUser.doPost(HelpAddUser.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NullPointerException
org.apache.jsp.admin_jsp._jspService(admin_jsp.java:74)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.servlet.HelpAddUser.doPost(HelpAddUser.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.30 logs.
源代码:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("gb2312");// 设置字符的编码格式为gb2312
String logname=(String)req.getParameter("logname");
String password=(String)req.getParameter("password");
User user=new User();
user.setLogname(logname);
user.setPassword(password);
UserDao userDao=new UserDao();
try{
userDao.saveUser(user);
}catch(Exception e){
e.printStackTrace();
}
RequestDispatcher rd=req.getRequestDispatcher("admin.jsp");
rd.forward(req,resp);
} 展开
3个回答
展开全部
admin.jsp的第74行报空指针异常。
请检查。
请检查。
追问
可是我的admin.jsp总共才33行啊!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
java.lang.NullPointerException
org.apache.jsp.admin_jsp._jspService(admin_jsp.java:74)
74行。空指针异常
org.apache.jsp.admin_jsp._jspService(admin_jsp.java:74)
74行。空指针异常
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询