webtier@glassfish.java.net

Re: JSF 2.0 composite components with method-valued attributes

From: <webtier_at_javadesktop.org>
Date: Wed, 25 Feb 2009 03:15:20 PST

BTW: I tried using a composite component with an attribute called "rendered"
like this:
 <composite:attribute name="rendered" default="true" type="Boolean" required="false" shortDescription="whether to render the header"/>
    
and ran into
   java.lang.IllegalArgumentException
        at sun.reflect.GeneratedMethodAccessor1970.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1787)
        at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1667)
        at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.copyTagAttributesIntoComponentAttributes(CompositeComponentTagHandler.java:128)
        at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyCompositeComponent(CompositeComponentTagHandler.java:189)
        at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyNextHandler(CompositeComponentTagHandler.java:155)
        at com.sun.faces.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:192)
        at com.sun.faces.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:90)
        at com.sun.faces.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:101)
        at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:182)
        at com.sun.faces.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:376)
        at com.sun.faces.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:347)
        at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:106)
        at com.sun.faces.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:90)
        at com.sun.faces.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:361)
        at com.sun.faces.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:192)
        at com.sun.faces.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:90)
        at com.sun.faces.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:361)
        at com.sun.faces.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:192)
        at com.sun.faces.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:90)
        at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
        at com.sun.faces.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:90)
        at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:80)
        at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:285)
        at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:331)
        at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:310)
        at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:181)
        at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:159)
        at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:86)
        at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:80)
        at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:132)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:543)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:288)
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:152)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:102)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
        at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)

I even tried using it only on client side, but got the same exception. I ended up wrapping it with h:panelGroup with rendered attribute. You may want to improve error reporting...
[Message sent by forum member 'nzinoviev' (nzinoviev)]

http://forums.java.net/jive/thread.jspa?messageID=333728