You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mariano Petrakovsky <mp...@tecnonexo.com> on 2005/11/17 18:44:29 UTC

phase event...

I have a table into database, with the ids of some fields in a page with a
boolean attribute  "visible".

My Jsf pages are all ready, then I need dynamically catch a phase before
render, look each component in this page an look in the database if this
field just be rendered.

I think i need put an phase listener... if is true... where I can read how
make this?

					Thanxs

--
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo -  www.tecnonexo.com

Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.


· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·




Re: phase event...

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,
you can't intercept between component creation and rendering.
see this thread:
http://www.mail-archive.com/users%40myfaces.apache.org/msg11950.html

The only way to have components before the render phase is to provide
application created components via binding attribute.

Mariano Petrakovsky wrote:
> I have a table into database, with the ids of some fields in a page with a
> boolean attribute  "visible".
> 
> My Jsf pages are all ready, then I need dynamically catch a phase before
> render, look each component in this page an look in the database if this
> field just be rendered.
> 
> I think i need put an phase listener... if is true... where I can read how
> make this?
> 
> 					Thanxs
> 
> --
> Mariano G. Petrakovsky
> Programmer · Software Factory
> AXG Tecnonexo -  www.tecnonexo.com
> 
> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> Argentina.
> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
> 
> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
> 
> 
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · ·
> 
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Re: phase event...

Posted by Ryan Wynn <bi...@gmail.com>.
On 11/17/05, Simon Kitching <sk...@obsidium.com> wrote:
> Of course using Clay means a totally different layout technology, just
> like using Facelets.

That's not entirely true.  I believe you can still use jsp with clay
and take advantage of my earlier example.  You just would need to wrap
your jsp in a clay tag.

Like <clay:clay>, someone correct me if I am wrong.

Sorry if I was top-posting I am fairly new to mailing lists ;)

Re: phase event...

Posted by Simon Kitching <sk...@obsidium.com>.
Mariano Petrakovsky wrote:
> Simon, you can send me the source code of this render wrapper?
> 
> I don't understand the complete idea... maybe if i look the code, i do.
> 

Sorry. Mariano, but there is no such code. I was just suggesting that it 
seemed to be possible to solve the problem that way.

The point is that you need to have custom code run before each component 
is rendered, but a phase listener can't do that for the first view of 
the page when JSP is used.

However the *renderer* can do that. You can't subclass every single JSF 
renderer to add the custom code; that's far too much work. However you 
could *wrap* every standard renderer in a class that calls your custom 
code before delegating to the real renderer.

Now renderers are "registered" by calling a method on the Application 
class (or is it the ViewHandler? I don't have the JSF specs to hand just 
now, or my earlier email). So by substituting your own implementation 
here you can ensure that as each renderer is added during MyFaces 
startup it is wrapped with your custom wrapper.

Regards,

Simon

RE: phase event...

Posted by Mariano Petrakovsky <mp...@tecnonexo.com>.
Simon, you can send me the source code of this render wrapper?

I don't understand the complete idea... maybe if i look the code, i do.

Thanxs! :)


-- 
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo -  www.tecnonexo.com

Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires · Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.


· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
 

-----Mensaje original-----
De: Simon Kitching [mailto:skitching@obsidium.com]
Enviado el: Jueves, 17 de Noviembre de 2005 16:52
Para: MyFaces Discussion
Asunto: Re: phase event...


Of course using Clay means a totally different layout technology, just 
like using Facelets. That's not necessarily bad (JSP sucks) but it may 
or may not be possible for you (JSP is unfortunately mandated for the 
project I'm currently on).

In the email thread referenced by Volker I did suggest one possible 
solution while staying with JSP. It's a bit hacky but I don't see why it 
wouldn't work. See the last paragraph of my response here:
  http://www.mail-archive.com/users%40myfaces.apache.org/msg11991.html

Regards,

Simon

PS: I hate top-posting!!

Ryan Wynn wrote:
> This kind of thing may be put into shale clay as well.  It's not there
> yet, but I have been writing to Gary V. to put it in.
> 
> See the following thread -
> http://www.mail-archive.com/dev%40struts.apache.org/msg13515.html
> 
> Basically, the idea is that with commons chain you get a hook that
> lets you access the component tree a component has been created but
> before it is rendered.  And you do not have to have application
> created components via binding attribute like Volker mentioned.  Also
> it should work with the case of tree being created dynamically and
> tree being restored.
> 
> Your command impl could look like this:
> 
> public class SetRenderedCommand implements
> org.apache.commons.chain.Command {
> public boolean execute(Context ctx) throws Exception {
>   ClayContext clayCtx = (ClayContext) ctx;
>   FacesContext facesCtx = clayCtx.getFacesContext();
>   UIComponent parent = clayCtx.getParent();
>     if ("clayView".equals(clay.getId())) {
>               // scan component tree and set rendered appropriately   	
>     }
>   return false;
> }
> }
> 
> And add a chain-config.xml to WEB-INF like this:
> 
> <catalog           name="clayCustomization">
>   <chain           name="postprocessAddComponent">
>     <command  className="com.foo.SetRenderedCommand"/>
>   </chain>
> </catalog>
> 
> Not this is not yet implemented.  But hopefully will be soon ;)
> 
> 
> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>> Thanxs... I will try!
>>
>> :)
>>
>> --
>> Mariano G. Petrakovsky
>> Programmer · Software Factory
>> AXG Tecnonexo -  www.tecnonexo.com
>>
>> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
>> Argentina.
>> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>>
>> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
>> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>>
>>
>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · ·
>>
>> -----Mensaje original-----
>> De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
>> McClanahan
>> Enviado el: Jueves, 17 de Noviembre de 2005 15:27
>>
>> Para: MyFaces Discussion
>> Asunto: Re: phase event...
>>
>>
>>
>> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>>> Hi Craig... and what about Volker Weber post...?
>>>
>>> If I set rendered property false to a component in before render method,
>> works now?
>>> Thanxs ! :)
>> It depends on whether you are:
>>
>> * Using JSP with the standard ViewController (which in JSF 1.1 builds
>>   the tree dynamically on the first pass through.).
>>
>> * Redisplaying the same page, so that the component tree is already
>>   created.
>>
>>
>>
>> Craig
>>
>>
>>>
>>> --
>>> Mariano G. Petrakovsky
>>> Programmer · Software Factory
>>> AXG Tecnonexo -  www.tecnonexo.com
>>>
>>> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
>> Argentina.
>>> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>>>
>>> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
>>> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>>>
>>>
>>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · · ·
>>>
>>> -----Mensaje original-----
>>> De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
>> McClanahan
>>> Enviado el: Jueves, 17 de Noviembre de 2005 15:01
>>> Para: MyFaces Discussion
>>> Asunto: Re: phase event...
>>>
>>>
>>>
>>>
>>>
>>> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>>>> I have a table into database, with the ids of some fields in a page with
>> a
>>>> boolean attribute  "visible".
>>>>
>>>> My Jsf pages are all ready, then I need dynamically catch a phase before
>>>> render, look each component in this page an look in the database if this
>>>> field just be rendered.
>>>>
>>>> I think i need put an phase listener... if is true... where I can read
>> how
>>>> make this?
>>>
>>> Yes, a phase listener is the strategy you'd want for this.  The basic idea
>> would be to have the backing bean for your page register itself (probably in
>> the constructor) as a phase listener for the Render Response phase, and then
>> in the beforePhase() event handler you'd do the scan of components and set
>> the "rendered" properties appropriately.  Don't forget to also deregister
>> yourself as a listener (in the afterPhase() event method) to avoid memory
>> leaks.
>>> Or, just use Shale's ViewController API, and put your "check the database"
>> code in the prerender() method.  Shale will do all the event listener wiring
>> for you, so you don't have to.
>>>     http://struts.apache.org/shale/






Re: phase event...

Posted by Simon Kitching <sk...@obsidium.com>.
Of course using Clay means a totally different layout technology, just 
like using Facelets. That's not necessarily bad (JSP sucks) but it may 
or may not be possible for you (JSP is unfortunately mandated for the 
project I'm currently on).

In the email thread referenced by Volker I did suggest one possible 
solution while staying with JSP. It's a bit hacky but I don't see why it 
wouldn't work. See the last paragraph of my response here:
  http://www.mail-archive.com/users%40myfaces.apache.org/msg11991.html

Regards,

Simon

PS: I hate top-posting!!

Ryan Wynn wrote:
> This kind of thing may be put into shale clay as well.  It's not there
> yet, but I have been writing to Gary V. to put it in.
> 
> See the following thread -
> http://www.mail-archive.com/dev%40struts.apache.org/msg13515.html
> 
> Basically, the idea is that with commons chain you get a hook that
> lets you access the component tree a component has been created but
> before it is rendered.  And you do not have to have application
> created components via binding attribute like Volker mentioned.  Also
> it should work with the case of tree being created dynamically and
> tree being restored.
> 
> Your command impl could look like this:
> 
> public class SetRenderedCommand implements
> org.apache.commons.chain.Command {
> public boolean execute(Context ctx) throws Exception {
>   ClayContext clayCtx = (ClayContext) ctx;
>   FacesContext facesCtx = clayCtx.getFacesContext();
>   UIComponent parent = clayCtx.getParent();
>     if ("clayView".equals(clay.getId())) {
>               // scan component tree and set rendered appropriately   	
>     }
>   return false;
> }
> }
> 
> And add a chain-config.xml to WEB-INF like this:
> 
> <catalog           name="clayCustomization">
>   <chain           name="postprocessAddComponent">
>     <command  className="com.foo.SetRenderedCommand"/>
>   </chain>
> </catalog>
> 
> Not this is not yet implemented.  But hopefully will be soon ;)
> 
> 
> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>> Thanxs... I will try!
>>
>> :)
>>
>> --
>> Mariano G. Petrakovsky
>> Programmer · Software Factory
>> AXG Tecnonexo -  www.tecnonexo.com
>>
>> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
>> Argentina.
>> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>>
>> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
>> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>>
>>
>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · ·
>>
>> -----Mensaje original-----
>> De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
>> McClanahan
>> Enviado el: Jueves, 17 de Noviembre de 2005 15:27
>>
>> Para: MyFaces Discussion
>> Asunto: Re: phase event...
>>
>>
>>
>> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>>> Hi Craig... and what about Volker Weber post...?
>>>
>>> If I set rendered property false to a component in before render method,
>> works now?
>>> Thanxs ! :)
>> It depends on whether you are:
>>
>> * Using JSP with the standard ViewController (which in JSF 1.1 builds
>>   the tree dynamically on the first pass through.).
>>
>> * Redisplaying the same page, so that the component tree is already
>>   created.
>>
>>
>>
>> Craig
>>
>>
>>>
>>> --
>>> Mariano G. Petrakovsky
>>> Programmer · Software Factory
>>> AXG Tecnonexo -  www.tecnonexo.com
>>>
>>> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
>> Argentina.
>>> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>>>
>>> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
>>> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>>>
>>>
>>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
>> · · · · ·
>>>
>>> -----Mensaje original-----
>>> De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
>> McClanahan
>>> Enviado el: Jueves, 17 de Noviembre de 2005 15:01
>>> Para: MyFaces Discussion
>>> Asunto: Re: phase event...
>>>
>>>
>>>
>>>
>>>
>>> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>>>> I have a table into database, with the ids of some fields in a page with
>> a
>>>> boolean attribute  "visible".
>>>>
>>>> My Jsf pages are all ready, then I need dynamically catch a phase before
>>>> render, look each component in this page an look in the database if this
>>>> field just be rendered.
>>>>
>>>> I think i need put an phase listener... if is true... where I can read
>> how
>>>> make this?
>>>
>>> Yes, a phase listener is the strategy you'd want for this.  The basic idea
>> would be to have the backing bean for your page register itself (probably in
>> the constructor) as a phase listener for the Render Response phase, and then
>> in the beforePhase() event handler you'd do the scan of components and set
>> the "rendered" properties appropriately.  Don't forget to also deregister
>> yourself as a listener (in the afterPhase() event method) to avoid memory
>> leaks.
>>> Or, just use Shale's ViewController API, and put your "check the database"
>> code in the prerender() method.  Shale will do all the event listener wiring
>> for you, so you don't have to.
>>>     http://struts.apache.org/shale/



Re: phase event...

Posted by Ryan Wynn <bi...@gmail.com>.
This kind of thing may be put into shale clay as well.  It's not there
yet, but I have been writing to Gary V. to put it in.

See the following thread -
http://www.mail-archive.com/dev%40struts.apache.org/msg13515.html

Basically, the idea is that with commons chain you get a hook that
lets you access the component tree a component has been created but
before it is rendered.  And you do not have to have application
created components via binding attribute like Volker mentioned.  Also
it should work with the case of tree being created dynamically and
tree being restored.

Your command impl could look like this:

public class SetRenderedCommand implements
org.apache.commons.chain.Command {
public boolean execute(Context ctx) throws Exception {
  ClayContext clayCtx = (ClayContext) ctx;
  FacesContext facesCtx = clayCtx.getFacesContext();
  UIComponent parent = clayCtx.getParent();
    if ("clayView".equals(clay.getId())) {
              // scan component tree and set rendered appropriately   	
    }
  return false;
}
}

And add a chain-config.xml to WEB-INF like this:

<catalog           name="clayCustomization">
  <chain           name="postprocessAddComponent">
    <command  className="com.foo.SetRenderedCommand"/>
  </chain>
</catalog>

Not this is not yet implemented.  But hopefully will be soon ;)


On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
> Thanxs... I will try!
>
> :)
>
> --
> Mariano G. Petrakovsky
> Programmer · Software Factory
> AXG Tecnonexo -  www.tecnonexo.com
>
> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> Argentina.
> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>
> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>
>
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · ·
>
> -----Mensaje original-----
> De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
> McClanahan
> Enviado el: Jueves, 17 de Noviembre de 2005 15:27
>
> Para: MyFaces Discussion
> Asunto: Re: phase event...
>
>
>
> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
> >
> > Hi Craig... and what about Volker Weber post...?
> >
> > If I set rendered property false to a component in before render method,
> works now?
> >
> > Thanxs ! :)
>
> It depends on whether you are:
>
> * Using JSP with the standard ViewController (which in JSF 1.1 builds
>   the tree dynamically on the first pass through.).
>
> * Redisplaying the same page, so that the component tree is already
>   created.
>
>
>
> Craig
>
>
> >
> >
> > --
> > Mariano G. Petrakovsky
> > Programmer · Software Factory
> > AXG Tecnonexo -  www.tecnonexo.com
> >
> > Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> Argentina.
> > Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
> >
> > Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> > Tel.: (202) 986-7541 - Fax: (202) 787-3891.
> >
> >
> > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · · ·
> >
> >
> > -----Mensaje original-----
> > De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
> McClanahan
> > Enviado el: Jueves, 17 de Noviembre de 2005 15:01
> > Para: MyFaces Discussion
> > Asunto: Re: phase event...
> >
> >
> >
> >
> >
> > On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
> > > I have a table into database, with the ids of some fields in a page with
> a
> > > boolean attribute  "visible".
> > >
> > > My Jsf pages are all ready, then I need dynamically catch a phase before
> > > render, look each component in this page an look in the database if this
> > > field just be rendered.
> > >
> > > I think i need put an phase listener... if is true... where I can read
> how
> > > make this?
> >
> >
> > Yes, a phase listener is the strategy you'd want for this.  The basic idea
> would be to have the backing bean for your page register itself (probably in
> the constructor) as a phase listener for the Render Response phase, and then
> in the beforePhase() event handler you'd do the scan of components and set
> the "rendered" properties appropriately.  Don't forget to also deregister
> yourself as a listener (in the afterPhase() event method) to avoid memory
> leaks.
> >
> > Or, just use Shale's ViewController API, and put your "check the database"
> code in the prerender() method.  Shale will do all the event listener wiring
> for you, so you don't have to.
> >
> >     http://struts.apache.org/shale/
> >
> > Craig
> >
> >
> >
> > >                                         Thanxs
> > >
> > > --
> > > Mariano G. Petrakovsky
> > > Programmer · Software Factory
> > > AXG Tecnonexo -  www.tecnonexo.com
> > >
> > > Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> > > Argentina.
> > > Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
> > >
> > > Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> > > Tel.: (202) 986-7541 - Fax: (202) 787-3891.
> > >
> > >
> > > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · ·
> > > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · ·
> > > · · · ·
> > >
> > >
> > >
> > >
> >
> >
>
>

RE: phase event...

Posted by Mariano Petrakovsky <mp...@tecnonexo.com>.
Thanxs... I will try!

:)
--
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo -  www.tecnonexo.com

Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.


· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·


  -----Mensaje original-----
  De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
McClanahan
  Enviado el: Jueves, 17 de Noviembre de 2005 15:27
  Para: MyFaces Discussion
  Asunto: Re: phase event...





  On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
    Hi Craig... and what about Volker Weber post...?

    If I set rendered property false to a component in before render method,
works now?

    Thanxs ! :)

  It depends on whether you are:

  * Using JSP with the standard ViewController (which in JSF 1.1 builds
    the tree dynamically on the first pass through.).

  * Redisplaying the same page, so that the component tree is already
    created.



  Craig




    --
    Mariano G. Petrakovsky
    Programmer · Software Factory
    AXG Tecnonexo -  www.tecnonexo.com

    Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
    Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

    Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
    Tel.: (202) 986-7541 - Fax: (202) 787-3891.


    · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · ·


      -----Mensaje original-----
      De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
McClanahan
      Enviado el: Jueves, 17 de Noviembre de 2005 15:01
      Para: MyFaces Discussion
      Asunto: Re: phase event...





      On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
        I have a table into database, with the ids of some fields in a page
with a
        boolean attribute  "visible".

        My Jsf pages are all ready, then I need dynamically catch a phase
before
        render, look each component in this page an look in the database if
this
        field just be rendered.

        I think i need put an phase listener... if is true... where I can
read how
        make this?

      Yes, a phase listener is the strategy you'd want for this.  The basic
idea would be to have the backing bean for your page register itself
(probably in the constructor) as a phase listener for the Render Response
phase, and then in the beforePhase() event handler you'd do the scan of
components and set the "rendered" properties appropriately.  Don't forget to
also deregister yourself as a listener (in the afterPhase() event method) to
avoid memory leaks.

      Or, just use Shale's ViewController API, and put your "check the
database" code in the prerender() method.  Shale will do all the event
listener wiring for you, so you don't have to.

          http://struts.apache.org/shale/

      Craig




                                                Thanxs

        --
        Mariano G. Petrakovsky
        Programmer · Software Factory
        AXG Tecnonexo -  www.tecnonexo.com

        Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
        Argentina.
        Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

        Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 ·
USA.
        Tel.: (202) 986-7541 - Fax: (202) 787-3891.


        · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·
        · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·
        · · · ·








Re: phase event...

Posted by Craig McClanahan <cr...@apache.org>.
On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>
> Hi Craig... and what about Volker Weber post...?
>  If I set rendered property false to a component in before render method,
> works now?
>  Thanxs ! :)
>

It depends on whether you are:

* Using JSP with the standard ViewController (which in JSF 1.1 builds
the tree dynamically on the first pass through.).

* Redisplaying the same page, so that the component tree is already
created.



Craig


--
> Mariano G. Petrakovsky
> Programmer · Software Factory
> AXG Tecnonexo - www.tecnonexo.com <http://www.tecnonexo.com>
>
> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> Argentina.
> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>
> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>
>
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> · · · · ·
>
> -----Mensaje original-----
> *De:* craigmcc@gmail.com [mailto:craigmcc@gmail.com]*En nombre de *Craig
> McClanahan
> *Enviado el:* Jueves, 17 de Noviembre de 2005 15:01
> *Para:* MyFaces Discussion
> *Asunto:* Re: phase event...
>
>
>
> On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
> >
> > I have a table into database, with the ids of some fields in a page with
> > a
> > boolean attribute "visible".
> >
> > My Jsf pages are all ready, then I need dynamically catch a phase before
> > render, look each component in this page an look in the database if this
> >
> > field just be rendered.
> >
> > I think i need put an phase listener... if is true... where I can read
> > how
> > make this?
>
>
> Yes, a phase listener is the strategy you'd want for this. The basic idea
> would be to have the backing bean for your page register itself (probably in
> the constructor) as a phase listener for the Render Response phase, and then
> in the beforePhase() event handler you'd do the scan of components and set
> the "rendered" properties appropriately. Don't forget to also deregister
> yourself as a listener (in the afterPhase() event method) to avoid memory
> leaks.
>
> Or, just use Shale's ViewController API, and put your "check the database"
> code in the prerender() method. Shale will do all the event listener wiring
> for you, so you don't have to.
>
> http://struts.apache.org/shale/
>
> Craig
>
>
>  Thanxs
> >
> > --
> > Mariano G. Petrakovsky
> > Programmer · Software Factory
> > AXG Tecnonexo - www.tecnonexo.com <http://www.tecnonexo.com>
> >
> > Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> > Argentina.
> > Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
> >
> > Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> > Tel.: (202) 986-7541 - Fax: (202) 787-3891.
> >
> >
> > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> > · ·
> > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> > · ·
> > · · · ·
> >
> >
> >
> >
>

RE: phase event...

Posted by Mariano Petrakovsky <mp...@tecnonexo.com>.
Hi Craig... and what about Volker Weber post...?

If I set rendered property false to a component in before render method,
works now?

Thanxs ! :)

--
Mariano G. Petrakovsky
Programmer · Software Factory
AXG Tecnonexo -  www.tecnonexo.com

Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
Argentina.
Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
Tel.: (202) 986-7541 - Fax: (202) 787-3891.


· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · ·


  -----Mensaje original-----
  De: craigmcc@gmail.com [mailto:craigmcc@gmail.com]En nombre de Craig
McClanahan
  Enviado el: Jueves, 17 de Noviembre de 2005 15:01
  Para: MyFaces Discussion
  Asunto: Re: phase event...





  On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
    I have a table into database, with the ids of some fields in a page with
a
    boolean attribute  "visible".

    My Jsf pages are all ready, then I need dynamically catch a phase before
    render, look each component in this page an look in the database if this
    field just be rendered.

    I think i need put an phase listener... if is true... where I can read
how
    make this?

  Yes, a phase listener is the strategy you'd want for this.  The basic idea
would be to have the backing bean for your page register itself (probably in
the constructor) as a phase listener for the Render Response phase, and then
in the beforePhase() event handler you'd do the scan of components and set
the "rendered" properties appropriately.  Don't forget to also deregister
yourself as a listener (in the afterPhase() event method) to avoid memory
leaks.

  Or, just use Shale's ViewController API, and put your "check the database"
code in the prerender() method.  Shale will do all the event listener wiring
for you, so you don't have to.

      http://struts.apache.org/shale/

  Craig




                                            Thanxs

    --
    Mariano G. Petrakovsky
    Programmer · Software Factory
    AXG Tecnonexo -  www.tecnonexo.com

    Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
    Argentina.
    Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.

    Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
    Tel.: (202) 986-7541 - Fax: (202) 787-3891.


    · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
    · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· ·
    · · · ·






Re: phase event...

Posted by Craig McClanahan <cr...@apache.org>.
On 11/17/05, Mariano Petrakovsky <mp...@tecnonexo.com> wrote:
>
> I have a table into database, with the ids of some fields in a page with a
> boolean attribute "visible".
>
> My Jsf pages are all ready, then I need dynamically catch a phase before
> render, look each component in this page an look in the database if this
> field just be rendered.
>
> I think i need put an phase listener... if is true... where I can read how
> make this?


Yes, a phase listener is the strategy you'd want for this. The basic idea
would be to have the backing bean for your page register itself (probably in
the constructor) as a phase listener for the Render Response phase, and then
in the beforePhase() event handler you'd do the scan of components and set
the "rendered" properties appropriately. Don't forget to also deregister
yourself as a listener (in the afterPhase() event method) to avoid memory
leaks.

Or, just use Shale's ViewController API, and put your "check the database"
code in the prerender() method. Shale will do all the event listener wiring
for you, so you don't have to.

http://struts.apache.org/shale/

Craig


Thanxs
>
> --
> Mariano G. Petrakovsky
> Programmer · Software Factory
> AXG Tecnonexo - www.tecnonexo.com <http://www.tecnonexo.com>
>
> Development facilities:Av. Maipú 1252 8º (C1006ACT) · Buenos Aires ·
> Argentina.
> Tel.: (54-11) 4878-0005 - Fax: (54-11) 4878-0065.
>
> Headquarters: 1604 Spring Hill Road, Suite 160 Vienna · VA 22182 · USA.
> Tel.: (202) 986-7541 - Fax: (202) 787-3891.
>
>
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> ·
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
> ·
> · · · ·
>
>
>
>