File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Page Navigation + Back Button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Page Navigation + Back Button" Watch "Page Navigation + Back Button" New topic

Page Navigation + Back Button

Aravind M Jay

Joined: Mar 16, 2006
Posts: 15

I have a JSP which shows a list of users. Each page is restricted to 10 records using pagination. My issue is -

Suppose I'm in the 3rd page and i click on the user name hyperlink i get the details of that user. I have a back button on this jsp page. So now when I click on this Back button i should go back to the 3rd page and not the 1st page. Right now it is redirecting me to the first page.

Is there any generic way which would work for all the JSPs?

I'm using Struts 1.2.

Thanks & Regards,
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Moving this to the more appropriate Struts forum.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
There is no real generic solution that I know of. With a web app you only have 2 real places to store user specific data, the session or the request (not counting external storage like a database). Using request scope could get messy because you would have to store the page number as a hidden field on your details page. This might work if you are talking about 1 field (page number) for one detail page. This does not work well if you have lots of fields (sort by values, sort column, page number, etc.) or you have lots of different detail pages.

My general solution is to store a class that contains the search information for the search results on the session. Then when the search results page is refreshed it knows to look on the session to get the various search fields...including the current page number.

- Brent
I agree. Here's the link:
subject: Page Navigation + Back Button
It's not a secret anymore!