Solved

Stopping parameter resubmit on refresh

Posted on 2004-04-02
3
1,494 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
ID: 10742074
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
ID: 10743840
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
ID: 10749047
Yep, just put sendRedirect(request.getRequestURI()) and it worked great. Thanks.
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

Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
An analysis of the phishing scam that has been affecting Google users, along with steps to take for protection, as well as what to do if you receive one of the emails.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 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

13 Experts available now in Live!

Get 1:1 Help Now