新手上路,江湖救急,牛人帮帮忙呀
我在浏览器里运行signup.jsp就会报一下错误:(看得我一头雾水)
org.apache.jasper.JasperException: Exception in JSP: /signup.jsp:61
58: prof.setUserid(signIn.getUserid());
59: //prof根据输入的参数userid,查询该用户数据库中其他数据,并保存在
60: //prof相关变量中
61: if(signIn.signIn()&&prof.select()){
62:
63: %>
64:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:467)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: Profile.update()null
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.signup_jsp._jspService(signup_jsp.java:260)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.Exception: Profile.update()null
com.jdon.simpleregister.Profile.select(Profile.java:215)
org.apache.jsp.signup_jsp._jspService(signup_jsp.java:149)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.23 logs.
signup.jsp源码
<%@ page language= "java " pageEncoding= "UTF-8 "%>
<jsp:useBean id= "signIn " scope= "session " class= "com.jdon.simpleregister.SignIn "/>
<jsp:useBean id= "prof " scope= "page " class= "com.jdon.simpleregister.Profile "/>
<jsp:setProperty name= "prof " property= "* "/>
<%@ include file= "head.html "%>
<%
//如果提交的是新增动作
if(request.getParameter( "add ")!=null){
//并且现有数据库这个email没有存在
if(prof.EmailExist()){
%>
<jsp:include page= "error.jsp?error_info=null=email已经存在 请重新调换一个! " flush= "true "/>
<%
return;
}
//通过Profile类的insert()方法将提交的表单数据插入
prof.insert();
%>
注册成功!
<%
}else if(request.getParameter( "edit ")!=null)//如果是编辑
{
//SignIn实例必须在Session中存在,在SignIn实例中
//保存用户的用户名和密码
if(!signIn.signIn()){
out.println( "No login ");
return;
}
//处理用户修改后的表单数据
prof.update();
%>
注册资料修改成功
<%
}else{
%>
<form action= "signup.jsp " name=Form1 method=post onsubmit= "return Juge(this); ">
<%
//将SignIn实例中的userid赋值给Profile实例prof
prof.setUserid(signIn.getUserid());
//prof根据输入的参数userid,查询该用户数据库中其他数据,并保存在
//prof相关变量中
if(signIn.signIn()&&prof.select()){
%>
用户名: <%=signIn.getUserid()%>
<input class= "button " type= "hidden " name= "edit " value= "1 ">
<%
}else { //否则当前为显示个人资料新增表单
%>
用户名
<input class= "button " name= "userid " value= " " size=10>
<%
}//怎么到这里就结束了这个else{},反而在下面进行补全,是不是代码错了
%>
... //为什么在这里不全呀?我也不懂
<%
}
%>
<%@ include file= "end.html "%>
[解决办法]
看看jsp的代码里面是不是有什么值为null的东西或者是边界出问题的异常
问题就出在61行那个方法,调试加个断点看看