>From: Ryan Wynn <[EMAIL PROTECTED]> > On 12/8/05, Mikael Andersson wrote: > > Hi, > > testing some clay templating ( base code from some very helpful posts in > > this > > forum), > > and it seems like I must have a managed bean associated to every view. > > Is this correct? > > > > When running the code below without a managed bean I get an error, but if I > > declare one for it it works fine. > > [snippet] > > > > When running this without a managed bean called 'test' in faces-config.xml, > > I > > get the following error: > > ERROR > > (org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/estoolweb]. > > > > [Faces > > Servlet]) - Servlet.service() for servlet Faces Servlet threw exception > > javax.faces.el.EvaluationException: Cannot get value for expression > > '#{test}' > > at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java > >
This is a stardard faces EL exception. It means that an object identified using token "test" can not be found as a managed bean or a object in request, session, and application scopes. [snippet] > >I think you could get it down to 1 managed-bean by doing this ><component jsfid="baseLayout" extends="clay"> > <attributes> > <set name="clayJsfid" value="/layout/layout.html"/> > </attributes> > <symbols> > <set name="managed-bean-name" value="layoutBean"/> > > <set name="title" value="Fasta"/> > <set name="navContent" value="/layout/defaultNav.html"/> > <set name="headerContent" value="/layout/defaultHeader.html"/> > <set name="bodyContent" value="/layout/defaultBody.html"/> > <set name="footerContent" value="/layout/defaultFooter.html"/> > </symbols> > </component> > > And declaring layoutBean in your faces-config.xml. Then you would > only need to do this once for all your layouts. Gary, can the > managed-bean be optional? Yep, the managed bean is optional and just another symbol that gets applied to the binding expression before the binding is created. If you prefer the symbol "myBean", you could add it as a symbol and do something like this, [EMAIL PROTECTED] Full views HTML veiws assume the same association with a ViewController so that you can pick up the extra events in the lifecycle. Gary