>From: Hermod Opstvedt <[EMAIL PROTECTED]> > > Hi > > I have defined a Clay component: > ><component jsfid="resultattabs" extends="clay" id="resultattabs" >allowBody="false"> ><attributes> > <set name="jsfid" value="RUNTIME"/> > <set name="managedBeanName" value="@managed-bean-name"/> > <set name="shapeValidator" value="[EMAIL PROTECTED]"/> > </attributes> ></component> >
The "jsfid" attribute should be named "clayJsfid". The "jsfid" here says that you want to use the clay component and the "clayJsfid" is the root component of the subtree under the clay component. The special "RUNTIME" clayJsfid indicates you want to build the metadata at runtime. Another way to do this is to use the "binding" attribute. You bind a component to a managed bean and add to it dynamically. Craig has an example of this in the sql-browser example application. This approach is tricky if you don't just delete the subtree and rebuild it. You will see in the sql-browser example, the children of the dataTable are cleared in the prerender method of the managed bean. http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/sql-browser/src/java/org/apache/shale/examples/sqlbrowser/Query.java?view=markup The Clay runtime option is similar but the component handles the details of finding an existing component versus creating a new one. In the clay method, you create a graph of objects used to create the JSF component where the binding method you actually create the components and hook them together. > > > Where @managed-bean-name is set to the faces defined managed bean > open$arrangement. > > I would have thought that Clay would resolve this to for instance > myBean.createTabs, but I am getting an error : > > Exception while invoking expression #{open$arrangement.createTabs} It looks like the symbol is being replaced. The expression show the "open$arrangement" substitued for "@managed-bean-name". If you look further down in the stack trace you will most likely seen another exception, "Caused by: java.lang.NoSuchMethodException:". This shapeValidator method binding signature is the same as the validator signature. The confusing part is that this method is invoked in the rendering phase and not the validation phase. The thought was that by implementing the method you are validating the shape of the subtree. I should have choose another attribute name. Make sure that your managed bean implements a method with the following signature: public void createTabs(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object displayElementRoot) { > > Hermod > Gary > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >