Solved

Pagination

Posted on 2003-10-30
8
430 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitOdd10 challenge 5 81
groovy example issue 10 90
looking for unix program to search some keywords in side EAR WAR and JAR files 10 82
difference of if loops 23 43
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now