*
The moose likes Struts and the fly likes bookmarking pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bookmarking pages" Watch "bookmarking pages" New topic
Author

bookmarking pages

Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
i read in the earlier posts that I should use tokens to avoid bookmarking of pages.
but in my situation i have action chaining so when i pass from action1 to action2, im guessing the request is reset and the token is invalid.
what is the best way around this.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

The token only resets when you call saveToken or resetToken (you'll usually call saveToken). If you never change the token, the same one is kept for an entire session.

You should have no problems with tokens even though you are chaining actions, Mannu.


A good workman is known by his tools.
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
So, Marc(or anybody else) this should work or am I doing something wrong

in action1:
save data from page 1 form
saveToken(request);
forward to action 2

in action 2:
if(isTokenValid(request))
then "get data from db for new page"
resetToken(request);
saveToken(request);
forward to page 2
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

IMO it's better like this:

in action1:
if(!isTokenValid(request)) > add ERROR and forward somewhere
save data from page 1 form
saveToken(request);// this does change token, by the way
forward to action 2

in action 2:
"get data from db for new page"
forward to page 2
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
din't know what i was thinking, that makes much more sense.
Thanks.
[ September 09, 2005: Message edited by: mannu kapoor ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bookmarking pages