Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use "previous" "next" buttons in a JSP page

 
giri shetty
Greenhorn
Posts: 27
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody can any one of u explain how to write a code for "next", ""previous" buttons ina jsp i will get only one record at a time if click "next' button i have to get next record and if i click "previous" button i have to get previous button.
please give me a hint
thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch giri!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
In addition, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not abbreviating these words.
Thanks!
bear
JSP Forum Bartender
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will all depend on how your data is stored and retrieved. I have a simple site with a bunch of pictures of the area. When I generate a page to show the first picture, I generate HTML links for next & prior that include picture numbers. So when you're looking at picture 2 I generate:
<a href="samepage?num=1>Prior</a> <a href="samepage?num=3">Next</a>
You need to generate buttons instead of links, but if you know HTML that should not be too tough. Where I got lucky is that I knew the picture number and the picture count.
If you're getting data from a SQL query and trying to keep track of where you are in the query results, things get tricky in a hurry. Try this thread: Pagination for more options.
[ January 22, 2004: Message edited by: Stan James ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic