File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts - Navigation Question

 
Matt Connors
Greenhorn
Posts: 23
  • 0
  • 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
 
Saritha Penumudi
Ranch Hand
Posts: 148
  • 0
  • 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
 
Venkatraman Kandaswamy
Ranch Hand
Posts: 120
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic