<%!CachedRowSetImpl rowSet;%>
<%
rowSet = (CachedRowSetImpl) session.getAttribute("rowSet");
int number = Integer.parseInt(request.getParameter("number"));
//rowSet.absolute(0);
rowSet.absolute(number);//将游标移动到Number行,如何将rowSet移动到第零行????
for (int i = 1; i <= 6; i++) {
out.print(rowSet.getString(i) + " ");
//读取第number行的第i列的数据并将其输出
}
%><br />我想得到rowSet行集中第一条的内容,rowSet.absolute(1)得到的是第二条的内容!
把光标移动到第0行,但是移动到第0行报出光标位置异常,那位大侠发发慈悲给解决一下,小弟在这里感激不尽!
即rowSet.absolute(0);报错
org.apache.jasper.JasperException: An exception occurred processing JSP page /poetry.jsp at line 3128:
29: <body bgcolor="ghostwhite">
30: <%!CachedRowSetImpl rowSet;%>
31: <%
32: rowSet = (CachedRowSetImpl) session.getAttribute("rowSet");
33: int number = Integer.parseInt(request.getParameter("number"));
34: //rowSet.absolute(0);
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause javax.servlet.ServletException: java.sql.SQLException: absolute: 光标位置无效
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.poetry_jsp._jspService(poetry_jsp.java:111)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
<%
rowSet = (CachedRowSetImpl) session.getAttribute("rowSet");
int number = Integer.parseInt(request.getParameter("number"));
//rowSet.absolute(0);
rowSet.absolute(number);//将游标移动到Number行,如何将rowSet移动到第零行????
for (int i = 1; i <= 6; i++) {
out.print(rowSet.getString(i) + " ");
//读取第number行的第i列的数据并将其输出
}
%><br />我想得到rowSet行集中第一条的内容,rowSet.absolute(1)得到的是第二条的内容!
把光标移动到第0行,但是移动到第0行报出光标位置异常,那位大侠发发慈悲给解决一下,小弟在这里感激不尽!
即rowSet.absolute(0);报错
org.apache.jasper.JasperException: An exception occurred processing JSP page /poetry.jsp at line 3128:
29: <body bgcolor="ghostwhite">
30: <%!CachedRowSetImpl rowSet;%>
31: <%
32: rowSet = (CachedRowSetImpl) session.getAttribute("rowSet");
33: int number = Integer.parseInt(request.getParameter("number"));
34: //rowSet.absolute(0);
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause javax.servlet.ServletException: java.sql.SQLException: absolute: 光标位置无效
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.poetry_jsp._jspService(poetry_jsp.java:111)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
解决方案 »
- 供应商创建的bapi
- 用wap 实现mp3搜索功能,页面需要显示哪些东东
- 有谁做过基于Swing的股票类的监控软件?实时数据的加载机制是怎样的?
- java代码如何用脚本的变量啊?
- 奇怪的问题,烦请帮忙解决
- 请问WebSphere Application Server和WebSphere MQ两个产品的关系是什么?
- 通过实体BEAN在客户端向ORACLE插入数据时,出现的问题
- 谁能告诉我 struts 的好处?
- 用jbuilder开发部署ejb,需要将项目建在特定的目录下吗?
- 加入的JDOM包在JSP中找不到
- Endpoint.publish发布服务问题
- struts2上传文件到tomcat虚拟目录问题
你说的“我想得到rowSet行集中第一条的内容,rowSet.absolute(1)得到的是第二条的内容!”应该是其他问题导致的,根据Java API说明:absoluteboolean absolute(int row)
throws SQLException
Moves the cursor to the given row number in this ResultSet object.
If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the method absolute(-2) moves the cursor to the next-to-last row, and so on.An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row.Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().
boolean first()
throws SQLException
Moves the cursor to the first row in this ResultSet object.
Returns:
true if the cursor is on a valid row; false if there are no rows in the result set
Throws:
SQLException - if a database access error occurs; this method is called on a closed result set or the result set type is TYPE_FORWARD_ONLY
SQLFeatureNotSupportedException - if the JDBC driver does not support this method
Since:
1.2