Solved

Pagination

Posted on 2003-10-30
8
429 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

743 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

11 Experts available now in Live!

Get 1:1 Help Now