--- Keith Bacon <[EMAIL PROTECTED]> wrote:
> Tuomo,
> Not totally finalised but at the moment I do it a
> bit
> like the example below.
> If you searched the archives for 'logon page' there
> are ways you can forward to the logon page & have it
> return to the page that started it, which is the
> same
> thing. These example are probably better than mine!
> Keith.
> ======
> example - form1 transfers to form2 & wants form2 to
> transfer to form1.
> 
> 
> form1 has
> /*
> * Let next form know where to return to.
> */
> request.addAttribute("returnTo",
> "globalForwardForm1");
> 
> 
> form2 has
> /*----
> 1 - save the input returnTo value. 1st time in
> caller
> has stored it as req. attribute. Subsequent times
> this
> action has saved it as a hidden field on the form
> (could save in the session).
> ------*/
> String returnTo = request.getAttribute("returnTo");
> if (returnTo == null) formBean.getReturnTo();
> 
> thisForm.setReturnTo() = returnTo;
> 
> /*
> * 2 - on completion
> */
> return new ActionForward("returnTo");
> 
> 
> 
> 
> 
> 
> --- Tuomo Syv�nper� <[EMAIL PROTECTED]>
> wrote:
> > 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]>
> > 
> 
> 
> __________________________________________________
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

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

Reply via email to