在线等待,各位兄弟帮帮忙,特别急的事情!

zflfaufa 2004-10-27 01:30:45
做了一个jsp网站,运行了几天好好的,突然报如下错误:
快帮帮我!!!!!!!!!!!!!!!!!!!
org.apache.jasper.JasperException: Before start of result set
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)

...全文
68 点赞 收藏 10
写回复
10 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zflfaufa 2004-10-27
感谢monkeyhjl(爬上墙头等红杏) ( 的回答,的确是应该我没有做rs.next的判断,导致数据库指针的问题,各位朋友,可要千万忘记啊,不知楼主多少我的是81832527 ,以后多多交流
回复
不徻写代码 2004-10-27
up
回复
dalianwang 2004-10-27
关注
回复
monkeyhjl 2004-10-27
if(rs.next()){
id=rs.getInt("user_no");
}
回复
zflfaufa 2004-10-27
<%@ page contentType= "text/html; charset=gb2312 "% >
<%@ page import= "java.sql.* "% >
<%
Class.forName( "org.gjt.mm.mysql.Driver ").newInstance();
Connection conn= DriverManager.getConnection( "jdbc:mysql://127.0.0.1/www?useUnicode=true&characterEncoding=GBK ", "www ", "wwww ");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
% >
<%
String no=request.getParameter( "no ");
String rand = (String)session.getAttribute( "rand ");//验证码
String code = request.getParameter( "code ");//获得的验证码
if(rand==null ¦ ¦ code==null ¦ ¦ code.trim().length() <=0 ¦ ¦ no==null ¦ ¦ im().length() <=0)
{
response.sendRedirect( "service.jsp ");
}
else
{
int no=Integer.parseInt(no);
String condition= "select user_no from users where user_no= "+no;
ResultSet rs=stmt.executeQuery(condition);
rs.next();
int id=rs.getInt( "user_no ");
rs.close();

if(id==no && rand.equals(code))
{
session.setAttribute( "noid ",new Integer(id)); //设置用户会话
String pwdprotsql= "select user_no from pwdprot where user_no= "+no;
ResultSet rs1=stmt.executeQuery(pwdprotsql);
if(rs1.next())
{
response.sendRedirect( "show.jsp ");
rs1.close();
}
else
{
response.sendRedirect( "error6.jsp ");
rs1.close();
}
}
else
{
response.sendRedirect( "error.jsp ");
}
}
% >
回复
zflfaufa 2004-10-27
特急,这是我的代码,帮在称看看
回复
zflfaufa 2004-10-27
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection conn= DriverManager.getConnection("jdbc:mysql://127.0.0.1/www?useUnicode=true&characterEncoding=GBK","www","wwww");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
%>
<%
String iLink_no=request.getParameter("no");
String rand = (String)session.getAttribute("rand");//验证码
String code = request.getParameter("code");//获得的验证码
if(rand==null || code==null || code.trim().length()<=0 || no==null || im().length()<=0)
{
response.sendRedirect("service.jsp");
}
else
{
int no=Integer.parseInt(iLink_no);
String condition="select user_no from users where user_no="+no;
ResultSet rs=stmt.executeQuery(condition);
rs.next();
int id=rs.getInt("user_no");
rs.close();

if(id==no && rand.equals(code))
{
session.setAttribute("noid",new Integer(id)); //设置用户会话
String pwdprotsql="select user_no from pwdprot where user_no="+no;
ResultSet rs1=stmt.executeQuery(pwdprotsql);
if(rs1.next())
{
response.sendRedirect("show.jsp");
rs1.close();
}
else
{
response.sendRedirect("error6.jsp");
rs1.close();
}
}
else
{
response.sendRedirect("error.jsp");
}
}
%>
回复
victorylj 2004-10-27
ResultSet rs=null;

取得rs结果集后,是否应增加一句:rs.next()
回复
victorylj 2004-10-27
把代码发上来,我给你看看
回复
zflfaufa 2004-10-27
org.apache.jasper.JasperException: Before start of result set 是什么问题,交交我
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告