This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Struts and the fly likes Changing the url in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Changing the url in browser" Watch "Changing the url in browser" New topic
Author

Changing the url in browser

kriegerd Salas
Greenhorn

Joined: Aug 01, 2005
Posts: 8
Hello everyone,

I have page A.jsp, it goes to Action1, this action forwards to Action2 and finally ends up in B.jsp. My problem is that in B.jsp the browser has the url of Action1, so if I reload the page (B.jsp) Action1 and Action2 are executed. I would like to change the url so that it points to Action2.
Does anyone knows how to do this??

Thanx in advance
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Assuming action1 has a forward something like this:

<forward name="success" path="/Action2.do"></forward>

Add redirect="true" to this tag.

This causes Struts to send an instruction back to the browser to redirect to Action2, thereby having the URL line in the browser read "Action2.do".

However, this has a side-effect that may be unwanted: the request context is lost between Action1 and Action2. That means that any objects you attached to the request will be gone. If you need to pass information from Action1 to Action2, you will have to do it with parameters passed in the URI.


Merrill
Consultant, Sima Solutions
kriegerd Salas
Greenhorn

Joined: Aug 01, 2005
Posts: 8
Fortunately I don't have that problem. I will give it a try. Thanx a lot!
 
 
subject: Changing the url in browser
 
jQuery in Action, 3rd edition