wood burning stoves 2.0*
The moose likes Struts and the fly likes Hide action name in browser address bar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Hide action name in browser address bar?" Watch "Hide action name in browser address bar?" New topic
Author

Hide action name in browser address bar?

A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
At the moment any jsp forwarded to displays the action name i.e http://localhost:8001/WMMapGet.do in the browser address bar - is it possible to not show this?
Using IE 5.5 (sp2)
thanks
Josh Landin
Greenhorn

Joined: Jun 09, 2003
Posts: 10
What would you prefer to see? The JSP form file name?
Maybe you're looking for redirect="true" on your forwards?
--
Josh
Satheesh Kumar G
Greenhorn

Joined: Feb 08, 2003
Posts: 21
hi,
Can you pls. explain how to use redirect="true" option. Pls. post an example(of struts config and action class) if possible.
Best Regards,
Satheesh
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4457
    
    6

redirect is an attribute in the forward element of an action-mapping in the struts-config.xml
You normally want to display the logical name (the Action path) so this actually hides the implementation name (the JSP).


Junilu - [How to Ask Questions] [How to Answer Questions]
A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
On the previous version of my app (not struts) - I used forward getRequestDispatcher(pageName).forward() to hide the actual JSP page the user was on - thereby only ever displaying the servlet name - this got around the problem of user's bookmarking any page & returning to them directly!
I was hoping to acheive the same with the rewritten struts app but can't seem to do it - is it best to put a check in all action commands checking for a session level variable & forward on to the start page if not set? - or what? - how is it normally handled using struts?
thanks
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4457
    
    6

Originally posted by harryajh:
this got around the problem of user's bookmarking any page & returning to them directly!
- is it best to put a check in all action commands checking for a session level variable & forward on to the start page if not set? - or what? - how is it normally handled using struts?


See saveToken(), resetToken(), and isTokenValid() methods in the Action class.
A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
thanks for replying - do you know of anywhere on the web that explains what tokens are & how/what they're used for? - can't find anything!
Will these allow me to force control back to a specific page if the user has bookmarked a page?
thanks
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4457
    
    6

Hmmm... a Google for "saveToken resetToken" turned up a bunch of links.
Try this one though: http://www.osborne.com/products/0072227117/0072227117_ch01.pdf
It has a section discussing the use of those methods.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hide action name in browser address bar?