Solved

Pagination

Posted on 2003-10-30
8
434 Views
Last Modified: 2008-03-10
Hi ,

Currently I am working on Struts.
I am working on a pagination code.
I have two hidden fields in my form namely 'next' and 'prev'.
I also have a <input type="image"> (for 'Next' and 'Prev'), on the click of which i set either of the two hidden fields to a value.
ON the server side, i check these values from request and take appropriate action.

The problem -
I click on the 'Next' image, and get appropriate action done. I get the expected output
page. Now if i press 'F5' or Refresh on the browser, on the server side the code written for
'Next' gets executed and instead of reloading the same page, it gives me the next expected page which is wrong. How do i stop this from happening ?

Thanks in advance...

Regards,
Janarthan S
0
Comment
Question by:janarthanasp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
8 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 500 total points
ID: 9648497
I use this with my struts app:

http://jsptags.com/tags/navigation/pager/index.jsp

it's really cool :-)  (and saved me all this sort of grief :-( )

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9648525
> How do i stop this from happening ?

Have you tried setting the redirect property on the ActionMapping for prev and next to "true"?

0
 
LVL 2

Expert Comment

by:f_98
ID: 9649019
i'd include another "index" hidden field just to ensure that everytime it executes a "next" command, it
starts off from this current index(of a list i suppose). (it is supposed to resubmit when you hit f5 anyway) so at least
it will keep on showing the same page. just like in google or other sites where you can see a start=x form element when you hit next
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 35

Expert Comment

by:TimYates
ID: 9649027
> (it is supposed to resubmit when you hit f5 anyway)

But you can get around this, by having the FormAction redirecting to the ViewAction...

then, refresh will just refresh the view, not resubmit data
0
 

Author Comment

by:janarthanasp
ID: 9649712
Hi Tim,

Thank you very much for the prompt response.
I am having a try with http://jsptags.com/tags/navigation/pager/index.jsp link that you gave. It looked like worth a shot.

Thanks again !!!
Regards,
Janarthan S
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9649728
Hope it works for you :-)

It is really rather cool :-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question