You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stefano Panero <st...@gmail.com> on 2007/07/06 10:13:42 UTC

change view id before render

Hi everybody,

I'm pretty sure that the answer is already in the list... but i can't find
it... sorry.

I've to do something like this:

1) click on a commndButton -> outcome -> new page
2) *before render* new page -> some beans' initialization

I knew I can do this either in the constructor of backing bean or  with a
managed setter properties (or maybe a PhaseListener, actually i don't now
how...)
But I need  one more  step:

3) If some conditions are true -> go to another page (another view)

I can't understand how can I do this. In which method?  In which phase?

Thank.
Stefano.

RE: change view id before render

Posted by William Hoover <wh...@nemours.org>.
I'm not sure if this will help you or not but it worked for chaining a login for me:
 
http://forum.java.sun.com/thread.jspa?threadID=792896 <http://forum.java.sun.com/thread.jspa?threadID=792896&messageID=4507691> &messageID=4507691
 
-----Original Message-----
From: Stefano Panero [mailto:stefano.panero@gmail.com]
Sent: Friday, July 06, 2007 1:18 PM
To: MyFaces Discussion
Subject: Re: change view id before render


I suppose so... I think It's a little bit weird... IMHO Render phase listener should be fired again...

Thanks a lot! Your component will be very useful anyway!


2007/7/6, Andrew Robinson < andrew.rw.robinson@gmail.com>: 

I doesn't look like it would work right now. The phase listener is 
only called once, the lifecycleimpl doesn't care if the viewId is
changed. So to support chaining, I would have to implement it myself
in the onload code.

On 7/6/07, Andrew Robinson <  <ma...@gmail.com> andrew.rw.robinson@gmail.com> wrote:
> I'd have to look into it. Since it is a phase listener, it would have
> to be called before the view is rendered. I am not sure if when a new
> view is created as a result of navigation, if the lifecycle component 
> re-fires the phase listeners.
>
> On 7/6/07, Stefano Panero < stefano.panero@gmail.com> wrote:
> > Thank you, your component is really interesting. 
> >
> > I take a look at the source and It seems to me I need just one more thing
> > (correct if I'am wrong):
> >
> > Page A -> Page B
> >
> > I can do some initialization before render page B, 
> > If, with your component, I add an an action method with an outcome that
> > makes me go to Page C, I can do
> > Paga A -> Page B (not rendered) -> Page C    (for end-user Page A -> Page C) 
> >
> > But If I have some logic in Page C initialization that makes me go to page
> > D?
> >
> > If I've understood I can't do this because the PhaseListener isn't fired 
> > again before Page C render, right?
> >
> > I mean: rules aren't chainable, are them?
> >
> > I think is somehow possible to do something like that... but maybe I'm just 
> > trying to raise universe entropy :)
> >
> > Stefano.
> >
> > 2007/7/6, Andrew Robinson < andrew.rw.robinson@gmail.com>: 
> > > Have a look at my on-load component:
> > >
> > >
> > http://jsf-comp.sourceforge.net/components/onload/index.html  <http://jsf-comp.sourceforge.net/components/onload/index.html> 
> > >
> > > Or use the one from JBoss-Seam or Shale
> > >
> > > On 7/6/07, Stefano Panero < stefano.panero@gmail.com> wrote: 
> > > > Hi everybody,
> > > >
> > > > I'm pretty sure that the answer is already in the list... but i can't
> > find
> > > > it... sorry.
> > > > 
> > > > I've to do something like this:
> > > >
> > > > 1) click on a commndButton -> outcome -> new page
> > > > 2) *before render* new page -> some beans' initialization 
> > > >
> > > > I knew I can do this either in the constructor of backing bean or  with
> > a
> > > > managed setter properties (or maybe a PhaseListener, actually i don't 
> > now
> > > > how...)
> > > > But I need  one more  step:
> > > >
> > > > 3) If some conditions are true -> go to another page (another view)
> > > > 
> > > > I can't understand how can I do this. In which method?  In which phase?
> > > >
> > > > Thank.
> > > > Stefano.
> > > >
> > > > 
> > > >
> > > >
> > >
> >
> >
>




Re: change view id before render

Posted by Stefano Panero <st...@gmail.com>.
I suppose so... I think It's a little bit weird... IMHO Render phase
listener should be fired again...

Thanks a lot! Your component will be very useful anyway!

2007/7/6, Andrew Robinson <an...@gmail.com>:
>
> I doesn't look like it would work right now. The phase listener is
> only called once, the lifecycleimpl doesn't care if the viewId is
> changed. So to support chaining, I would have to implement it myself
> in the onload code.
>
> On 7/6/07, Andrew Robinson <an...@gmail.com> wrote:
> > I'd have to look into it. Since it is a phase listener, it would have
> > to be called before the view is rendered. I am not sure if when a new
> > view is created as a result of navigation, if the lifecycle component
> > re-fires the phase listeners.
> >
> > On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> > > Thank you, your component is really interesting.
> > >
> > > I take a look at the source and It seems to me I need just one more
> thing
> > > (correct if I'am wrong):
> > >
> > > Page A -> Page B
> > >
> > > I can do some initialization before render page B,
> > > If, with your component, I add an an action method with an outcome
> that
> > > makes me go to Page C, I can do
> > > Paga A -> Page B (not rendered) -> Page C    (for end-user Page A ->
> Page C)
> > >
> > > But If I have some logic in Page C initialization that makes me go to
> page
> > > D?
> > >
> > > If I've understood I can't do this because the PhaseListener isn't
> fired
> > > again before Page C render, right?
> > >
> > > I mean: rules aren't chainable, are them?
> > >
> > > I think is somehow possible to do something like that... but maybe I'm
> just
> > > trying to raise universe entropy :)
> > >
> > > Stefano.
> > >
> > > 2007/7/6, Andrew Robinson <an...@gmail.com>:
> > > > Have a look at my on-load component:
> > > >
> > > >
> > > http://jsf-comp.sourceforge.net/components/onload/index.html
> > > >
> > > > Or use the one from JBoss-Seam or Shale
> > > >
> > > > On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> > > > > Hi everybody,
> > > > >
> > > > > I'm pretty sure that the answer is already in the list... but i
> can't
> > > find
> > > > > it... sorry.
> > > > >
> > > > > I've to do something like this:
> > > > >
> > > > > 1) click on a commndButton -> outcome -> new page
> > > > > 2) *before render* new page -> some beans' initialization
> > > > >
> > > > > I knew I can do this either in the constructor of backing bean
> or  with
> > > a
> > > > > managed setter properties (or maybe a PhaseListener, actually i
> don't
> > > now
> > > > > how...)
> > > > > But I need  one more  step:
> > > > >
> > > > > 3) If some conditions are true -> go to another page (another
> view)
> > > > >
> > > > > I can't understand how can I do this. In which method?  In which
> phase?
> > > > >
> > > > > Thank.
> > > > > Stefano.
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>

Re: change view id before render

Posted by Andrew Robinson <an...@gmail.com>.
I doesn't look like it would work right now. The phase listener is
only called once, the lifecycleimpl doesn't care if the viewId is
changed. So to support chaining, I would have to implement it myself
in the onload code.

On 7/6/07, Andrew Robinson <an...@gmail.com> wrote:
> I'd have to look into it. Since it is a phase listener, it would have
> to be called before the view is rendered. I am not sure if when a new
> view is created as a result of navigation, if the lifecycle component
> re-fires the phase listeners.
>
> On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> > Thank you, your component is really interesting.
> >
> > I take a look at the source and It seems to me I need just one more thing
> > (correct if I'am wrong):
> >
> > Page A -> Page B
> >
> > I can do some initialization before render page B,
> > If, with your component, I add an an action method with an outcome that
> > makes me go to Page C, I can do
> > Paga A -> Page B (not rendered) -> Page C    (for end-user Page A -> Page C)
> >
> > But If I have some logic in Page C initialization that makes me go to page
> > D?
> >
> > If I've understood I can't do this because the PhaseListener isn't fired
> > again before Page C render, right?
> >
> > I mean: rules aren't chainable, are them?
> >
> > I think is somehow possible to do something like that... but maybe I'm just
> > trying to raise universe entropy :)
> >
> > Stefano.
> >
> > 2007/7/6, Andrew Robinson <an...@gmail.com>:
> > > Have a look at my on-load component:
> > >
> > >
> > http://jsf-comp.sourceforge.net/components/onload/index.html
> > >
> > > Or use the one from JBoss-Seam or Shale
> > >
> > > On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> > > > Hi everybody,
> > > >
> > > > I'm pretty sure that the answer is already in the list... but i can't
> > find
> > > > it... sorry.
> > > >
> > > > I've to do something like this:
> > > >
> > > > 1) click on a commndButton -> outcome -> new page
> > > > 2) *before render* new page -> some beans' initialization
> > > >
> > > > I knew I can do this either in the constructor of backing bean or  with
> > a
> > > > managed setter properties (or maybe a PhaseListener, actually i don't
> > now
> > > > how...)
> > > > But I need  one more  step:
> > > >
> > > > 3) If some conditions are true -> go to another page (another view)
> > > >
> > > > I can't understand how can I do this. In which method?  In which phase?
> > > >
> > > > Thank.
> > > > Stefano.
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
>

Re: change view id before render

Posted by Andrew Robinson <an...@gmail.com>.
I'd have to look into it. Since it is a phase listener, it would have
to be called before the view is rendered. I am not sure if when a new
view is created as a result of navigation, if the lifecycle component
re-fires the phase listeners.

On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> Thank you, your component is really interesting.
>
> I take a look at the source and It seems to me I need just one more thing
> (correct if I'am wrong):
>
> Page A -> Page B
>
> I can do some initialization before render page B,
> If, with your component, I add an an action method with an outcome that
> makes me go to Page C, I can do
> Paga A -> Page B (not rendered) -> Page C    (for end-user Page A -> Page C)
>
> But If I have some logic in Page C initialization that makes me go to page
> D?
>
> If I've understood I can't do this because the PhaseListener isn't fired
> again before Page C render, right?
>
> I mean: rules aren't chainable, are them?
>
> I think is somehow possible to do something like that... but maybe I'm just
> trying to raise universe entropy :)
>
> Stefano.
>
> 2007/7/6, Andrew Robinson <an...@gmail.com>:
> > Have a look at my on-load component:
> >
> >
> http://jsf-comp.sourceforge.net/components/onload/index.html
> >
> > Or use the one from JBoss-Seam or Shale
> >
> > On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> > > Hi everybody,
> > >
> > > I'm pretty sure that the answer is already in the list... but i can't
> find
> > > it... sorry.
> > >
> > > I've to do something like this:
> > >
> > > 1) click on a commndButton -> outcome -> new page
> > > 2) *before render* new page -> some beans' initialization
> > >
> > > I knew I can do this either in the constructor of backing bean or  with
> a
> > > managed setter properties (or maybe a PhaseListener, actually i don't
> now
> > > how...)
> > > But I need  one more  step:
> > >
> > > 3) If some conditions are true -> go to another page (another view)
> > >
> > > I can't understand how can I do this. In which method?  In which phase?
> > >
> > > Thank.
> > > Stefano.
> > >
> > >
> > >
> > >
> >
>
>

Re: change view id before render

Posted by Stefano Panero <st...@gmail.com>.
Thank you, your component is really interesting.

I take a look at the source and It seems to me I need just one more thing
(correct if I'am wrong):

Page A -> Page B

I can do some initialization before render page B,
If, with your component, I add an an action method with an outcome that
makes me go to Page C, I can do
Paga A -> Page B (not rendered) -> Page C    (for end-user Page A -> Page C)

But If I have some logic in Page C initialization that makes me go to page
D?

If I've understood I can't do this because the PhaseListener isn't fired
again before Page C render, right?

I mean: rules aren't chainable, are them?

I think is somehow possible to do something like that... but maybe I'm just
trying to raise universe entropy :)

Stefano.

2007/7/6, Andrew Robinson <an...@gmail.com>:
>
> Have a look at my on-load component:
>
> http://jsf-comp.sourceforge.net/components/onload/index.html
>
> Or use the one from JBoss-Seam or Shale
>
> On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> > Hi everybody,
> >
> > I'm pretty sure that the answer is already in the list... but i can't
> find
> > it... sorry.
> >
> > I've to do something like this:
> >
> > 1) click on a commndButton -> outcome -> new page
> > 2) *before render* new page -> some beans' initialization
> >
> > I knew I can do this either in the constructor of backing bean or  with
> a
> > managed setter properties (or maybe a PhaseListener, actually i don't
> now
> > how...)
> > But I need  one more  step:
> >
> > 3) If some conditions are true -> go to another page (another view)
> >
> > I can't understand how can I do this. In which method?  In which phase?
> >
> > Thank.
> > Stefano.
> >
> >
> >
> >
>

Re: change view id before render

Posted by Andrew Robinson <an...@gmail.com>.
Have a look at my on-load component:

http://jsf-comp.sourceforge.net/components/onload/index.html

Or use the one from JBoss-Seam or Shale

On 7/6/07, Stefano Panero <st...@gmail.com> wrote:
> Hi everybody,
>
> I'm pretty sure that the answer is already in the list... but i can't find
> it... sorry.
>
> I've to do something like this:
>
> 1) click on a commndButton -> outcome -> new page
> 2) *before render* new page -> some beans' initialization
>
> I knew I can do this either in the constructor of backing bean or  with a
> managed setter properties (or maybe a PhaseListener, actually i don't now
> how...)
> But I need  one more  step:
>
> 3) If some conditions are true -> go to another page (another view)
>
> I can't understand how can I do this. In which method?  In which phase?
>
> Thank.
> Stefano.
>
>
>
>