• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Struts - Navigation Question

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Screen (Stat.jsp) that can be accessed from two different screens. Once the user is finished with Stat.jsp they should return to the screen they originally came from. In other words, I have an ActionMapping that on "success" should return to the screen it was called from.

Does Struts give you an easy way to accomplish this? How can I determine what screen I came from?

Thanks in advance,
Matt
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a same requirement. This is how I was thinking I can accomplish this.
Let us say we have three jsp's. 1.jsp. 2.jsp and 3.jsp

3.jsp can be accessed from 1.jsp and 2.jsp.
In both 1.jsp and 2.jsp I will have a hidden field called URL which is set to parentURL hidden field in 3.jsp. From Action class of 3.jsp I would say (request.getRequestDispatcher()).forward(form.getParentURL) which takes back to parent jsp.

Please post if u have better solution for this.

Thank you
Saritha
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if this will work :

In the execute function of your bean have this logic:



In your struts-config.xml file



 
Matt Connors
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the solution suggested will work.

Does that mean that Struts does not provide any direct support for this type of situation? I imagine that even a reasonably complex application will have this type of situation occur several times.

Doesn't Struts natively support this type of thing? Am I missing something?

Thanks,
Matt
 
Venkatraman Kandaswamy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be possible. Am not comfortable with this solution because of the scriplet but it should work i guess.

 
Matt Connors
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recognize there are many different ways this problem can be solved. I've done it myself several times while using my own homegrown web based application framework. What I'm trying to find out is whether Struts provides any direct support for this very common type of situation.

Thanks.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope.
 
Where does a nanny get ground to air missles? Protect this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic