• 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

Cancel button must go back to the previous jsp page

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic