Solved

Stopping parameter resubmit on refresh

Posted on 2004-04-02
3
1,474 Views
Last Modified: 2008-03-10
Hi,

Is there a way to stop parameters being resubmitted when a jsp page is refreshed. The parameters are being sent by GET but out of interest is there a way that could do it for POST or even both? Thanks.

-Sam
0
Comment
Question by:samblake
3 Comments
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
Comment Utility
well there is no sure shot way of doing it.... but we usually employ a switch method... i.e. we have a hidden field in every form of the system... it starts with a zero....... and when first request hits the server it goes in the session as 0.... now when the request is finished we bump it by one.... so next form gets it as 1.....
so next time around when the request comes back to us... we check if the session value is 1 less then the recieved one...
If not its considered as a resubmit/refresh....

try that if that works for you...
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 50 total points
Comment Utility
what Kuldeep suggested is refered as using token, Struts has build in token support.

another approach would be after processed the request. do response.sendRedirect() to the said jsp page (maybe itself), EE is taking this approach for this post thread.

I'm not saying which one is better. in fact token always work. sendRedirect() is easier but restricted by the why your jsp page is coded.
0
 
LVL 1

Author Comment

by:samblake
Comment Utility
Yep, just put sendRedirect(request.getRequestURI()) and it worked great. Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
A procedure for exporting installed hotfix details of remote computers using powershell
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

14 Experts available now in Live!

Get 1:1 Help Now