Hmm.. Nope. mapping.getInput() always returns the same thing regardless 
of the
page from which we came from.
Here's a bit more detailed explanation of what's going on:

I have a page (action: listArticles.do) which lists all articles. On 
this page if you
click on the edit - link, editArticle.do?action=Edit&id=123 action gets 
called.
This action redirects the user to the editArticle.jsp page which has the 
edit form in it.
Now if the user clicks on the title of the article on listArticles.do page,
viewArticle.do?id=123 action gets called and shows the article. On this 
page we
allso have an edit - link, which has the same url as the one on 
listArticles - page.

The form submits its contents to saveArticle.do - action which does just 
that.. Saves
the article using an EJB. After the save we should return to the calling 
page but at
this point we no longer know which page was the original caller. And 
even if we did,
we'd have no way of returning the request to the same state as it was 
before the
editArticle - link was pressed (ie. the viewArticle had the article id 
as a parameter and
if we forward control back to that viewArticle action, we really should 
have the id also).

Now in saveArticle - action mapping.getInput() returns the 
editArticle.jsp form and
not the page from which we came from..

/tuomo

Jon.Ridgway wrote:

>Hi Tuomo,
>
>You could try using:
>
>       mapping.getInput ()
>
>in your actions perform method.
>
>Jon.
>
>-----Original Message-----
>From: Tuomo Syvänperä [mailto:[EMAIL PROTECTED]] 
>Sent: 12 December 2001 09:47
>To: [EMAIL PROTECTED]
>Subject: Alternate form action
>
>Hi,
>How can I return to correct page after submitting a form which can be 
>called from
>several places..
>What I have is a action&form which can be accessed from many different 
>places.
>ie. I have page A with a link:
><html:link page="/editArticle.do?action=Edit" paramId="id" 
>paramName="article" paramProperty="id"><bean:message 
>key="global.edit"/></html:link>
>and page B with the same link. When the user posts the form, I'd like to 
>return to
>the page from which we came from.
>Problem is that I cannot tell what possible request parameters or 
>attributes the original
>page had gotten before the call to editArticle.
>
>Currently only solution I came up with was to set attributes to servlet 
>context, which
>contain the page to which we should return and all it's request 
>parameters. And then when
>I populate the editArticle form, I add all these attributes as hidden 
>fields to the form.
>After the form has been submitted the SaveArticleAction saves the form 
>data and
>redirects back to the original calling page..
>
>I hope my explanation was unclear enough :)
>
>Thx.
>Tuomo
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to