当前位置:编程学习 > JSP >>

student.jsp页面获取登陆界面的id,student.jsp采用分页显示,分页代码没问题,点击下一页时,程序报错

严重: Servlet.service() for servlet [jsp] in context with path [/gwork] threw exception [An exception occurred processing JSP page /student.jsp at line 55 52: %> 53: <tr> 54: <td>学号:</td> 55: <td><input type="text" name="id" readOnly style="width:40px" value="<%=s.getId() %>"></td> 56: </tr> 57: <tr> 58: <td>姓名:</td> Stacktrace:] with root cause java.lang.NullPointerException at org.apache.jsp.student_jsp._jspService(student_jsp.java:141) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
答案:登录界面的Student的ID应该放在SESSION里面,然后取出来。。。你的估计应该是在request里面,二次请求后就会出现空指向
其他:空指针~ 你检查下 s是不是出问题了。

55:    <td><input type="text" name="id" readOnly style="width:40px" value="<%=s.getId() %>"></td> 上下文路径异常,是不是你的路径写错了

上一个:我要在JSP代码输入一段文章, 然后查询到所有的文章生成对应的生成HTML页面,希望好心人够帮忙.
下一个:我要执一段JSP代码输入一段文章, 然后查询到所有的文章生成对应的生成HTML代码,希望好心人够帮忙.

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,