日期:2014-05-17  浏览次数:20787 次

Jsp一个简单问题
昨晚我运行这Jsp还好好的,今天早上一开机运行这就报错了,这是什么原因啊??搞不懂!!
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<form action="09.jsp" method="post">
账号:
<input name="account" type="text">
<br>
密码:
<input name="password" type="password">
<br>
<input type="submit" value="提交">
<%
String acc = request.getParameter("account");
String pas = request.getParameter("password");
if (acc.equals(pas)) {
%>
<jsp:forward page="0901.jsp"></jsp:forward>
<%
}
request.setAttribute("list", acc);
request.getAttribute(acc);
%>
</form>
</body>
</html>


2013-10-29 8:20:52 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp._09_jsp._jspService(_09_jsp.java:70)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
JSP Web Myeclipse

------解决方案--------------------
报的是空指针异常,我怀疑可能是这一行导致,可以考虑改成
if?(acc!=null && acc.equals(pas))


------解决方案--------------