Hi,

Here i am sending some code it will useful for displaying centain records at
a time

first keep all you'r records in two dimentational Array


        int start = 0;
        int maxRows = 10;
        int totalRows   = rows.length; // rows is array that contains all
records
        int displayRows = start + maxRows;

          if (displayRows > totalRows) displayRows = totalRows;


          for(int i=start; i<displayRows; i++)
          {
                ------
                -------
            }

for next and prevoius buttons

totalRows = rows.length;
int start =  0 ;

int maxRows = accountBean.getMaxRows();
int currentTotal = start + maxRows;
int difference = totalRows - currentTotal;
int nstart = 0;
          int pstart = 0;
          String next = "";
          String prev = "";



          if (currentTotal < totalRows)
          {
            if (difference > maxRows)
               next = "Next "+maxRows;
            else
               next = "Next "+difference;

            nstart  = currentTotal;
          }

          if ((start!=0)&&(totalRows!=0))
          {
            prev   = "Previous "+maxRows;
            pstart = start - maxRows;
          }


          String qs  = "function=move"+
                       "&start="+nstart;

if (!next.equals(""))
<A HREF='url?"+qs> next </A>
if (!prev.equals(""))
<A HREF='url?"+qs> previous</A>

HTH

Rajiv Kumar

----- Original Message -----
From: "Ashwani Kalra" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 24, 2000 4:55 PM


> Hi,
> I am using the bean on jsp page that brings certain no of records from the
> database.I want to show the user only 10 records at a time page wise by
> providing the previous and next link. Can any body tell me how to do that
!!
>
> Thanks
> Ashwani
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to