File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Java 8 in Action this week in the Java 8 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: 257
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: 257
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: 257
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
 
Similar Threads
doPost and Bookmarking
Correct way to check Session timeout?
disadvantages of Ajax. is it real?
Setting JDBC Connection object in the HttpSession?
Srikanth Shenoy: Bookmarking in Struts