myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@apache.org>
Subject Re: phase event...
Date Thu, 17 Nov 2005 18:01:26 GMT
On 11/17/05, Mariano Petrakovsky <mpetrakovsky@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.
>
>
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · ·
> ·
> · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
· · · · · · · ·
> ·
> · · · ·
>
>
>
>

Mime
View raw message