At 10.59 20/02/01 +0000, you wrote:
>Hi All,
>Could you please let me know how to display say 10 rows of a resultset at a
>time and navigate back and forth in a html form.
>
>Thanks.
Unfortunately, in Java there isn't a way like paged ResultSet of Visual
Basic, so the only way I solved it was this:
/* Resultset is already created, with a normal query. */
int RS_CursorStart=.... /* Start position */
String RS_CursorCount="10"; /*Use "*" for all */
if (RS.first()){
RS.absolute(RS_CursorStart);
if (!RS.isAfterLast()){
int Count=0;
int Limit=0;
if (!RS_CursorCount.equals("*"))
Limit=Integer.parseInt(RS_CursorCount);
do{
/*
Do what you want here...
*/
while ((RS.next() &&
((RS_CursorCount.equals("*"))?true:Count<Limit)));
}
}
Put this code in a method, passing RS_CursorStart and RS_CursorCount as
parameters. With this, you can display only a subset of the resultset, and
you keep track of the cursor position.
Bye
Fabrizio
Note: Suggestions are appreciated!!! :))))
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html