File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing Dynamic return button

 
Graham VMead
Ranch Hand
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
This has all the making of a stupid question but here goes.

I have a page which can be accessed from many other pages. I want to implement a return button so that pressing it causes the page to forward back to where it came from.

I've thought of each start page having an action mapping with a parameter of the start path

e.g screen 1 submit maps to an action with a parameter of screen 1's path
screen 2 submit maps to an action with a parameter of screen 2's path etc.

Setting a hidden field on the target screen and use this to get back to where you came from when you press the return button, e.g press return find the value of the hidden field and forward back to this!

Whew, is there a nicer way of doing this in struts?

TIA Graham
 
Ergin Er
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you implement the button as a submit button (e.g. <html:submit property="button">
you could add a value to it that contains the action path it's supposed to do.
And you can fill that value by extracting it from the form property where you put in the action path on loading the page. So just use your form to store the different actions.
Then in your action you can just read and execute required the action directly.
Or am I just talking rubbish here?
 
Rich Walton
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dont know if this fits your requirement, but how about using some javascript?

that will give you a link that when you click will take you back
 
Graham VMead
Ranch Hand
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ergin, Rich,

Thanks for the answers.

Rich I cant guarantee that javascript will be enabled, and also I may need the return to forward to the action of the page to return to rather than just doing a back.

Ergin, I could be talking rubbish but won't the submit button send a request path based on whats defined as the action on the html:form tag in the page containing the return button?

I suppose my question really is how do I get the path of screen 1 to be sent the page containing the return. Then I need to get hold of this when I press the submit button.

I could put it in the session but that doesn't seem right

Graham
[ September 16, 2005: Message edited by: Graham VMead ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic