The full stack trace of the root cause is available in the Apache Tomcat/8.0.33 logs.
Theserverencounteredaninternalerrorthatpreventeditfromfulfillingthisrequest.java.lang...
The server encountered an internal error that prevented it from fulfilling this request.
java.lang.NullPointerException
stu_score.servlet.ModifyPassword.doPost(ModifyPassword.java:32)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("GB2312");
PrintWriter out = response.getWriter();
String name = request.getParameter("name").trim();
System.out.print(name);
String password = request.getParameter("password").trim();
String stats = request.getParameter("stats").trim();
String id = request.getParameter("id").trim();
Connection conn = null;
PreparedStatement stat = null;
String sql="update teacher set name = '" + name + "',password = '" + password + "',stats = '" + stats + "' where id='" + id + "'";
try
{
conn = Sqlcon.getConnection();
stat = conn.prepareStatement(sql);
stat.executeUpdate();
out.print("<script language=\"JavaScript\">alert(\"修改成功 !\"); window.location.href='modifyPassword.jsp'; </script>");
} 展开
java.lang.NullPointerException
stu_score.servlet.ModifyPassword.doPost(ModifyPassword.java:32)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("GB2312");
PrintWriter out = response.getWriter();
String name = request.getParameter("name").trim();
System.out.print(name);
String password = request.getParameter("password").trim();
String stats = request.getParameter("stats").trim();
String id = request.getParameter("id").trim();
Connection conn = null;
PreparedStatement stat = null;
String sql="update teacher set name = '" + name + "',password = '" + password + "',stats = '" + stats + "' where id='" + id + "'";
try
{
conn = Sqlcon.getConnection();
stat = conn.prepareStatement(sql);
stat.executeUpdate();
out.print("<script language=\"JavaScript\">alert(\"修改成功 !\"); window.location.href='modifyPassword.jsp'; </script>");
} 展开
1个回答
2016-05-10
展开全部
空指针异常,在ModifyPassword.java:32 行 打短点 ,调试一下
追问
我在出错的界面debug了一下
Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource.
,这个要怎么解决
追答
页面请求 是get, 后台方法是POST,不统一导致的,统一 一下
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询