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?
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.