Composite component in JAR issue with cc.attrs

For my composite component which is packaged in JAR I've used a <cc:interface> with a simple <cc:attribute> and, of course a <cc:implementation>.

In Development stage, I've a javax.faces.view.facelets.TagException which complains about cc:interface component not detected for identifier «j_idt6.getParent()». In Production stage, it seems to work, but the value of <cc:attribute> doesn't show as expected.

I've seen on the web a JIRA issue JAVASERVERFACES-1903, but it seems a bit old. Does anybody have a clue how to resolve it? Do you think that this issue will be solved one day? How do you deals with composite components in JAR files with your projects?

My config is Mojarra 2.1.4 under Glassfish 3.1.


Update from OP post, below:

Here is the error:

/file:/D:/Users/simplicity2k/Documents/NetBeansProjects/tmp/application/application-ear/target/gfdeploy/org.simplicity2k_application-ear_ear_1.0-SNAPSHOT/application-web-1.0-SNAPSHOT_war/WEB-INF/lib/components-1.0-SNAPSHOT.jar!/META-INF/resources/components/sampleOutput.xhtml @8,23 <cc:interface> Composant non détecté pour l’identificateur «j_idt6.getParent()».

And the stacktrace :

javax.faces.view.facelets.TagException: /file:/D:/Users/simplicity2k/Documents/NetBeansProjects/tmp/application/application-ear/target/gfdeploy/org.simplicity2k_application-ear_ear_1.0-SNAPSHOT/application-web-1.0-SNAPSHOT_war/WEB-INF/lib/components-1.0-SNAPSHOT.jar!/META-INF/resources/components/sampleOutput.xhtml @8,23 <cc:interface> Composant non détecté pour l’identificateur «j_idt6.getParent()».
at com.sun.faces.facelets.tag.composite.InterfaceHandler.validateComponent(InterfaceHandler.java:135)
at com.sun.faces.facelets.tag.composite.InterfaceHandler.apply(InterfaceHandler.java:125)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:326)
at com.sun.faces.facelets.tag.UserTagHandler.apply(UserTagHandler.java:142)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:769)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)

The files in my JAR :

META-INF/resources/components/sampleOutput.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:cc="http://java.sun.com/jsf/composite">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="colorRed" default="F00" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <h:panelGroup layout="block" styleClass="componentContainer" style="border:1px solid \##{cc.attrs.colorRed};">
            <h:outputText value="Sample Output Component #{cc.attrs.colorRed}" />
        </h:panelGroup>
    </cc:implementation>

</html>

And the META-INF/components.taglib.xml

<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:composite="http://java.sun.com/jsf/composite"
              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
              version="2.0">

    <namespace>http://simplicity2k.org/components</namespace>
    <composite-library-name>components</composite-library-name>
    <tag>
        <tag-name>sampleOutput</tag-name>
        <source>resources/components/sampleOutput.xhtml</source>
    </tag>

</facelet-taglib>

Answers


You shouldn't have the need for a taglib.xml file at all. Remove it and reference your composites in the views by the following namespace:

xmlns:ec="http://java.sun.com/jsf/composite/components"

The "/components" part refers to the folder "/components" which you have there in the resources folder.

See also:

Need Your Help

Swift - do-while loop unexpected error

xcode swift do-while

I am going through Apple's Swift Guide and I encountered an error in a do-while loop and I can't work out why Xcode throws the error.

Program 'for loop' is changing multiple values in the array in one instance

c# loops for-loop directx direct2d

I was working line by line in the debugger option (red dot) in express 2010 visual c#.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.