I'm trying to prevent multiple submits of a page from hitting the "refresh" browser button.
I have tried putting in the code to use tokens, but it does not work.
In action class 1, I have put "saveToken(request)" when loading the
jsp's data.
When the user hits the continue button, it goes back to action class 1 and redirects to action class 2, where it processes data and displays the results in jsp 2. I am checking isTokenValid(request) in action class 2 (as that is the one that will be accessed when the user hits the refresh button) but it is always false, so nothing is ever processed.
Does the
struts token thing not work when linking action classes?
Just to check, I put an isTokenValid(request) line in the code where I'm checking if the continue button was pushed, and that is working fine....so it will work if the user hits the "back" button, but what can I do about hitting the "refresh" button on the results page?
Here is a quick little psuedo-code of what I'm doing:
action class 1:
if (continueButton != null)
{
setContinueButton(null);
if (isTokenValid(request))
{
//do some stuff
//forward to action class 2
resetToken(request);
}
else
{
//forward to jsp2 without doing anything
}
}
else
{
loadPage();
saveToken(request);
forward = mapping.findForward("jsp1");
}
action class 2:
if (isTokenValid(request))
{
//process data
//display results
resetToken(request);
}
//forward to jsp2
[ May 10, 2006: Message edited by: K Dombroski ]