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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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. > > > > > > > > > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · > · · > > > · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · > · · > > > · · · · > > > > > > > > > > > > > > > > > >

