views:

397

answers:

2

Hello, i have a jsp page that has a submit button. This button is linked with another jsp page.

So lets assume my stuts file looks like this:

B.jsp

So now the submit button being on page "A.jsp" will take me to B.jsp. This works. The problem is that i want to do the following:

press on the submit button on page A.jsp , go to B.jsp where i will press again a button and go back to A.jsp . The problem is that to page B.jsp go many pages, so B.jsp has to know when pressing the submit button to which page will take me back , in this case A.jsp again.

So in a few words, B.jsp has to know from which page i came from so that i can go back again by pressing a submit button (this could be a parameter that would be sent back to A.jsp again, but does not really matter at the current point)

A.jsp -> B.jsp -> A.jsp C.jsp -> B.jsp -> C.jsp

A: 

sorry one part was missing:

action name="KatalogeintragAnlegen" class="katalogeintrag.KatalogeintragAnlegenAction"> <result name="insertedThesaurus" type="tiles" >B.jsp</result>
</action>

Stephan
you should put info this into your question, you can edit it
leonbloy
A: 

I guess your B.jsp is some sort of general result page, which displays a message and invites the user to return to the previous page -before the submission. If you dont want to read the browser history with javascript (I woudn't) the standard approach is to pass the "returnUrl" as a property of your Action. This seems straighforward to me.

leonbloy
you are close to what i need. meaning that yes B.jsp is some kind of a result page with an action button, which when pressed it has to return me back to the page i came from. The question is how could i pass the returnUrl as a property in my Action as you said ? Thank you for your reply :)
Stephan
The same way you pass any property to a jsp page in Struts2. Eg: by making a method `getReturnUrl()` in your action and using `<s:property value="returnUrl" />` in your jsp.
leonbloy