Well, I don't have code, but I can at least explain how I might approach it.
First, if your using JDBC 2.0, I think there is the ability to move forward
and backwards in a ResultSet from the database. However..I am not sure, so
my first intuition would be to use some sort of counter in your controller
class. I assume your using MVC setup? At any rate, say you get a Vector of
objects back from the database..1000 of them. You want to display 10. Using
an HttpSession object of some sort (probably a bean that the JSP page has
access to via session scope is best), you keep a count of where in the
vector you are at. First of all..you most likely will want to display a list
of links that allow the user to jump x amount of items at a time. If you got
1000 items back, you would use some sort of math to take the total output,
and divide it into say 10 sections. In this case you might see something
like:
<- prev x next x ->
0 100 200 300 400 500 600 700 800 900
The above being "links" that jump you to item 100, 200, 300, etc. Then, in
your JSP page you would do a loop:
<%
int cnt = bean.getCurrentPosition() + 10;
for( int cntr = bean.getCurrentPosition(); cntr < cnt; cntr++ )
{
// bean.getResults() is a bean Vector variable that points to the entire
Vector of results received from the database
SomeClassName scn = (SomeClassName)
bean.getResults().getElementAt(cntr);
%>
<a href="some_href_link_<%= cntr %>">Item <%= scn.getName() %></a><br>
<%
}
%>
That isn't exactly how it should be done..but its close. Basically, the
SomeClassName would be the class that represents each Object in the Vector.
You get each class so you can display its name, contents, whatever the link
is to say. You may also want to display more parts of the object beyond the
link..such as static text, item number, etc.
I hope this gets you started.
> -----Original Message-----
> From: Marco [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 15, 2000 11:58 AM
> To: [EMAIL PROTECTED]
> Subject: JSP page that display 10 result...
>
>
> How to make a JSP page that display 10 result (from a DB) per
> time and after
> with a next and prev link going forward the result??
> Can anyone explain me to this??
> Ca i have a code that explain this???
> Thanx in advance...
> marks
>
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets