The question is how many records realistically do u expect to retun to
the user if it is say in tens then 

You have to use season variables to keep track of the exact number of
records as well as an array where you have copied the result set retuned
by the database. This is easy if you kow how to work dynamic array and
session variables.

In the first instance is the records are say 50 and you want to show 10
per page you divide and use that number in a loop which prints a
<hyperlink> x where x is the number of loops. So the first page you
would print ten records and 4 hyperlinks to pages 2345 which would
contain records from 10-20 20-30 30-40 40-50 respectively.

>From then on it's easy. If you want to print the next page you click on
2.

Now the hyperlinks number would normally point the same JSP. So in the
beginning you would have a condition to check the 
Request parameter value.this may be a hidden number associated with
every page in order to keep track of the page fomr which the request
came. If it is page '2' then check the array and session variables . If
they are not empty then you would print the correspoding records...

It is actually harder exlpaining it rather than implementing it.

Just remember all happens in the same JSP.

And the trick is the conditions in the beginning. Associate numbers with
each page.
Check where did the request came from.
Open sesstion array
Display appropriate range of records.
Print hyperlinks for remaining records.

I hope this helps
panos



-----Original Message-----
From: Luca Ventura [mailto:[EMAIL PROTECTED]] 
Sent: 16 May 2002 14:52
To: [EMAIL PROTECTED]
Subject: How can I show many records to a user?


Hello everybody!

I am developing a Web application that for every user:

1) Receives the request;
2) Accesses to a database to get the data (records) required;
3) Show the records found in the database to the users.

So I used a jsp page that makes this job for me but I have the following
problem:
given that the records (and each of them can have more fields) to show
could be thousands I can't insert all of them in the same html page; so
I would like to show them like many search engines do (like google or
Altavista): that is to say using different pages and giving the possibly
to move from a page to another. Anyway I want to be able to decide the
layout to use to show the results that can be different from that one
used from google or Altavista.

How can I do it? Any idea?

Thanks a lot in advance.

                   Luca

========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found
at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to