Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Double submit handling using struts tokens

843838Jan 30 2006 — edited Feb 9 2006
Hi,

I am using struts token to handle double submit.

The way i have implemented is,

wrote a base Action class.
Inside the BaseAction class i have overriden the resetToken method like this,

synchronized public void resetToken(javax.servlet.http.HttpServletRequest request) {
javax.servlet.http.HttpSession session;
session = request.getSession(false);
if (session == null) {
return;
}
session.removeAttribute("org.apache.struts.action.TOKEN");
saveToken(request);

}


I m calling saveToken inside resetToken for new pages.

So how it would work is first time in my action i would call saveToken which would set token in my jsp page and then in respective actions i would check if isTokenValid(),

and then call resetToken so that i would clear the old on and set the new one for the new jsp page.


Is that the right way i m doing it ?

Please suggest me if there is better way to handle it.

Thanks
Abbyss
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2006
Added on Jan 30 2006
1 comment
193 views