aspose file tools*
The moose likes Struts and the fly likes Struts - Navigation Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts - Navigation Question" Watch "Struts - Navigation Question" New topic
Author

Struts - Navigation Question

Matt Connors
Greenhorn

Joined: Sep 08, 2004
Posts: 23
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
Saritha Penumudi
Ranch Hand

Joined: Aug 18, 2003
Posts: 147
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
Venkatraman Kandaswamy
Ranch Hand

Joined: Jul 07, 2004
Posts: 120
See if this will work :

In the execute function of your bean have this logic:



In your struts-config.xml file





--Venkatraman<br />SCJP 1.4<br /><a href="http://kvrlogs.blogspot.com" target="_blank" rel="nofollow">blog</a>
Matt Connors
Greenhorn

Joined: Sep 08, 2004
Posts: 23
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

Joined: Jul 07, 2004
Posts: 120
It should be possible. Am not comfortable with this solution because of the scriplet but it should work i guess.

Matt Connors
Greenhorn

Joined: Sep 08, 2004
Posts: 23
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.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Nope.


A good workman is known by his tools.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts - Navigation Question