This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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:
subject: How token works in struts
Similar Threads
Multiple file Download
tiles struts
Struts interview questions...
Can I use the paramProperty from a hyperlink in a textfield in the called .jsp-page?
Form does not carry data