Topic: 求救一个简单的JSP问题

  Print this page

1.求救一个简单的JSP问题 Copy to clipboard
Posted by: pc
Posted on: 2004-12-31 11:40

//前面的引用
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>

...
...
<%
String test = "";
ResultSet rs1 = DB.exSql(s_SQL1);
if(!rs1.isAfterLast()){
while (rs1.next()){
if(rs1.isLast()) ////出错处,我想定位到最后一条记录,除这这种方法还有别的方法没有?
test = "last";
else
test = "mid";
};
};
%>

程序员调用时出错,信息在下面,请教怎样解决

javax.servlet.ServletException: ????????????: isLast
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
  org.apache.jsp.jsp.department.treeDepartment_jsp._jspService(treeDepartment_jsp.java:144)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause

java.sql.SQLException: ????????????: isLast
  oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
  oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
  oracle.jdbc.driver.OracleResultSetImpl.isLast(OracleResultSetImpl.java:416)
  org.apache.jsp.jsp.department.treeDepartment_jsp._jspService(treeDepartment_jsp.java:112)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

谢谢

2.Re:求救一个简单的JSP问题 [Re: pc] Copy to clipboard
Posted by: 93184
Posted on: 2005-01-01 01:08

java.sql.SQLException: ????????????: isLast

3.Re:求救一个简单的JSP问题 [Re: pc] Copy to clipboard
Posted by: dennisjl
Posted on: 2005-01-02 04:01

你可以这样实现:

while (rs.hasNext())
{
rs.next();
if (rs.hasNext())
test = "mid";
else
{
test = "last";
break;
}
}

4.Re:求救一个简单的JSP问题 [Re: pc] Copy to clipboard
Posted by: logix
Posted on: 2005-01-06 20:58

直接调 last()方法就可以定位到最后一条记录啊,不过请注意游标的打开方式。

5.Re:求救一个简单的JSP问题 [Re: pc] Copy to clipboard
Posted by: nego_sun_java
Posted on: 2005-01-10 20:58

java 中最好不要用2层以上的循环判断,内部容易出错。

6.Re:求救一个简单的JSP问题 [Re: pc] Copy to clipboard
Posted by: xiaoyu216
Posted on: 2005-01-13 17:16

什么意思


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923