当前位置: 技术问答>java相关
请JSP高手指教!
来源: 互联网 发布时间:2015-11-08
本文导语: JSP源代码: 注册 错误报告: Error: 500 Location: /examples/BBS/registerlogic.jsp Internal Servlet Error: javax.servlet.ServletException at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source) at...
JSP源代码:
注册
错误报告:
Error: 500
Location: /examples/BBS/registerlogic.jsp
Internal Servlet Error:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
at BBS.registerlogic_11._jspService(registerlogic_11.java:170)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcBoundCol.setRowValues(JdbcOdbcBoundCol.java:240)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateChar(JdbcOdbcResultSet.java:3767)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateString(JdbcOdbcResultSet.java:3257)
at BBS.registerlogic_11._jspService(registerlogic_11.java:113)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
删除以下语句后可以运行:
rs.updateString(1, newusername);
rs.updateString(2, password);
rs.updateString(3, e_mail);
rs.insertRow();
问题可能出在哪?
注册
错误报告:
Error: 500
Location: /examples/BBS/registerlogic.jsp
Internal Servlet Error:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
at BBS.registerlogic_11._jspService(registerlogic_11.java:170)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
Root cause:
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcBoundCol.setRowValues(JdbcOdbcBoundCol.java:240)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateChar(JdbcOdbcResultSet.java:3767)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateString(JdbcOdbcResultSet.java:3257)
at BBS.registerlogic_11._jspService(registerlogic_11.java:113)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
删除以下语句后可以运行:
rs.updateString(1, newusername);
rs.updateString(2, password);
rs.updateString(3, e_mail);
rs.insertRow();
问题可能出在哪?
|
代码应该没有问题,可能是你的配置问题,重新配置一下服务器看看。
|
sqlquerystring = "SELECT * FROM user";
改为:
sqlquerystring = "SELECT username FROM user";
也就是说要写具体的列名称,
要多少写多少,
决不能用*来代替!
改为:
sqlquerystring = "SELECT username FROM user";
也就是说要写具体的列名称,
要多少写多少,
决不能用*来代替!
|
参数值错误或者为空
你看看
rs.updateString(1, newusername);
rs.updateString(2, password);
rs.updateString(3, e_mail);
中的各个参数值是什么,你执行这三个语句之前最好打印他们的值出来。
你看看
rs.updateString(1, newusername);
rs.updateString(2, password);
rs.updateString(3, e_mail);
中的各个参数值是什么,你执行这三个语句之前最好打印他们的值出来。
|
rs = stmt.executeQuery(sqlquerystring);
改为:
rs = stmt.executeUpdate(sqlquerystring);
改为:
rs = stmt.executeUpdate(sqlquerystring);
|
try:
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
sqlquerystring = "SELECT * FROM user";
rs = stmt.executeQuery(sqlquerystring);
rs.moveToInsertRow() ; //rs.last();改为
rs.updateString(1, newusername);
rs.updateString(2, password);
rs.updateString(3, e_mail);
rs.insertRow();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
sqlquerystring = "SELECT * FROM user";
rs = stmt.executeQuery(sqlquerystring);
rs.moveToInsertRow() ; //rs.last();改为
rs.updateString(1, newusername);
rs.updateString(2, password);
rs.updateString(3, e_mail);
rs.insertRow();