问题描述
HTTPStatus500-typeExceptionreportmessagedescriptionTheserverencounteredaninternalerror()thatpreventeditfromfulfillingthisrequest.exceptionorg.apache.jasper.JasperException:AnexceptionoccurredprocessingJSPpage/Modpassword.jspatline9996:{97://检测旧密码输入是否正确98:out.println("<script>alert('testsuccess!');</script>");99:oldPas=newString(request.getParameter("Oldpassword").getBytes("ISO8859_1"),"GBK");100:Statementsmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);101:sql="select*fromadminwhereusername='"+session.getAttribute("username")+"'";102:ResultSetst=smt.executeQuery(sql);Stacktrace:org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)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)rootcausejava.lang.NullPointerExceptionorg.apache.jsp.Modpassword_jsp._jspService(Modpassword_jsp.java:174)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:377)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)noteThefullstacktraceoftherootcauseisavailableintheApacheTomcat/6.0.26logs.
解决方案
解决方案二:
request.getParameter("Oldpassword")应该是这个返回的是null。你检查一下代码吧,分开写,不能保证不为null的话要做一下非null判断。