File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Cancel button must go back to the previous jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cancel button must go back to the previous jsp page" Watch "Cancel button must go back to the previous jsp page" New topic
Author

Cancel button must go back to the previous jsp page

Sumithab Baskaran
Ranch Hand

Joined: Oct 29, 2004
Posts: 52
Hello!

Consider this:

There are 3 jsp pages/forms(A, B, C) and respective action classes.

JSP A has two buttons - Comments and Cancel
JSP B has two buttons - Comments and Cancel

JSP C is the comments page - has a cancel button

When the C page is accessed from A page, the cancel button in C must go back to A.
When the C page is accessed from B page, the cancel button in C must go back to B.

What is the best way to do this in struts?

Thanks in advance.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd just put a "returnTo" property on my form bean for C, have JSPs A and B pass returnTo as a parameter to C. Then the C action can return to either A or B based on the value of the parameter.

Another way to do this would be to define two different action mappings, (commentsA and commentsB) both of which call the C action class. Each mapping would have a local forward named "cancel". In commentsA, the forward would point to JSP A, and in commentsB, the forward would point to JSP B. That way, when the C action class returns the "cancel" forward, it goes to different JSPs depending on which action mapping invoked the class.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cancel button must go back to the previous jsp page