wood burning stoves
The moose likes Struts and the fly likes How token works in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How token works in struts" Watch "How token works in struts" New topic

How token works in struts

kundanyasutech kundanyasutech

Joined: Sep 09, 2005
Posts: 1
Hi guys,

can anyone explain me how
isTokenValid(javax.servlet.http.HttpServletRequest request)
saveToken(javax.servlet.http.HttpServletRequest request)
works in struts.

Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

When saveToken() is called, a hidden field will automatically be added to forms in your jsps (assuming you use html:form). The Struts servlet stores [in session] the most recent token.

isTokenValid() checks to see if the hidden variable submitted with the form matches the most recent one set through the saveToken method.

A good workman is known by his tools.
I agree. Here's the link: http://aspose.com/file-tools
subject: How token works in struts
It's not a secret anymore!