• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing the url in browser

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
kriegerd Salas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fortunately I don't have that problem. I will give it a try. Thanx a lot!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic