2013年10月29日星期二

Jsp one simple question

Last night I run this Jsp still alive this morning, which runs a boot error , which is why ah ? ? Do not understand ! !
<%@ 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
Serious : 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)
------ Solution -------------------- ------------------------
reported that the null pointer exception , I suspect that it was this line causes can be considered changed
if (acc! = null && acc.equals (pas))


------ Solution ------------------------------------ --------
acc and pas insistence . to null it.
------ Solution ---------------------------------------- ----
if (acc.equals (pas)) this line acc may be null
------ Solution ------------- -------------------------------
do not worry about yesterday, how, to solve the problem today it is empty , you submit the page with your displayed page is the same page ? Call : 09.jsp that you just came in , String acc = request.getParameter ("account");
String pas = request.getParameter ("password" ;) ; these two values ​​obtained must be null,
------ Solution --------------------------- -----------------
account number and password should be submitted to the 09.jsp do not verify what, how the verification code on the current page of the
--- --- For reference only ---------------------------------------
not empty value ah , I put if () {} replaced out.print (acc + pas); acc and pas is not null
------ For reference only --- ------------------------------------

after clicking Submit judge username and password whether the same , the same as on the landing to the welcome screen , not the same as it stays on the current page · · · · ·
------ For reference only ----------- ----------------------------
after class back , refresh what project is successful , the code did not change I do not know what the problem is , but thank you for help

没有评论:

发表评论