• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How token works in struts

 
kundanyasutech kundanyasutech
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

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

Thanks,
kundan
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic