myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evgeniy Karimov <karimoveug...@mail.ru>
Subject Re: Re[2]: Passing objects between pages after redirect
Date Thu, 06 Sep 2007 11:05:14 GMT


> 
> No, I didn't meant that you should redirect programmatically. In both cases you use faces-config
NavigationRule to handle transition. 'redirect' is merely parameter on how to handle that
transition. If <redirect/> is present, then navigation will be handled traditional way:
server asks browser to navigate from faces/page1.jspx to faces/page2.jspx. By default, navigation
is handled a little differently: server just 'switch' servlets. From browser's point of view
response is rendered by page1.jspx, while on the server page1.jspx processes user's request,
but response is rendered by page2.jspx. 
> 
> You should refer to some JSF tutorials or documentation for detailed explanation on how
it all works 
OK, thank you, I surely will.
> Hope it helps.
Very much:)
> > 
> > > It is not clear, weather you use "redirect" navigation rule.
> > I'm asking what to use. And as I got it from your message, I shouldn't. So could
you please provide me with small code sample of programmatic redirection from page1 to page2
then? Like in actionListener of page1 I want to redirect to page2. Then (if I understood correctly),
I should use this code:
> > > FacesContext fctx = FacesContext.getCurrentContext()
> > > Bean2 b2 = fctx.getApplication().getVariableResolver().resolveVariable( fctx,
"bean2" );
> > Right?
> > > Alternatively you can use managed property to let JSF provide bean1 with link
to bean2 automatically.
> > Oh, thanks, this concept looks quite easy, but I also need to redirect right in
code, not by <redirect>...
> > > Then, you can just set all necessary values in bean2 from bean1. Note, that
if bean2 is request-scoped then this method will work only if you don't use <redirect/>.
As otherwise bean2 will be reinstantiated after invokeApplication phase and all bean2 fields'
values will be effectively lost. Your option in this case is to use session to store bean2
directly or not.
> >   And thanks you very much, your message was very informative and helpful!
> > 
> > > 
> > > 
> > > 
> > > > 
> > > > Sorry original message was without subject field.
> > > > 
> > > > -----Original Message-----
> > > > From: Evgeniy Karimov <karimoveugene@mail.ru>
> > > > To: users@myfaces.apache.org
> > > > Date: Thu, 06 Sep 2007 12:57:07 +0400
> > > > Subject: 
> > > > 
> > > > > 
> > > > > Hi, I have a small question:
> > > > > 
> > > > > I have a .faces page, that collects some data from user. All state
is kept at client side via Tomahawk saveState component. And after user clicks "Next step"
button, I want to redirect him to next page, and pass the collected data to that .faces page.
What is best method to perform that?
> > > > >  I dont wont to pass object with data via session scope bean, because
I want the page1 pass object exclusively to page2, not via all-pages-accessible session scope.
Is there a way to do it? Like write a page2's request bean, so it can be then stored in saveState?
> > > > >  There is something about this problem in saveState source comments,
but I can get how to perform this two action (redirect and pass object) to achieve my aid.
> > > > > 
> > > > >     Thanks in advance.
> > > > > 
> > > > 
> > > 
> > > 
> > 
> 
> 

Mime
View raw message