4

We use composite components inside other components in our project. Everything works just fine on JBoss 7.1.0, but on JBoss 7.1.1 we get errors like this:

No handlers found for exception javax.faces.view.facelets.TagException: 
/resources/components/my/bigComponent.xhtml @21,47 <my:nestedComponent> 
Tag Library supports namespace: http://java.sun.com/jsf/composite/components/my, 
but no tag was defined for name: nestedComponent

We tried the solution suggested in this JBoss community thread, but it changed nothing to our problem (seams we're not the only one in this case, and the solution may not work because we're also in a ui:define tag from a template file).

Here our two components:

The nesting:

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

<cc:interface componentType="...">
    <h:panelGroup>
        <cc:attribute name="someAttribute" />
    </h:panelGroup>
</cc:interface>

<cc:implementation>
     <my:nestedComponent content="a text" />
</cc:implementation>
</html>

The nested:

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

<cc:interface>
    <cc:attribute name="content" />
</cc:interface>

<cc:implementation>
    <h:outputText value="#{cc.attrs.content}" />
</cc:implementation>

</html>

Is it a regression? Are we doing something wrong ? In the 1st link, the suggested solution implies in the nesting component something like this:

<composite:interface>
    <composite:facet name="greet1"/>
    <composite:facet name="greet2"/>
</composite:interface>
<composite:implementation>
    <lib:greet1 name="Stan" />
    <lib:greet2 name="Silvert" />
</composite:implementation>

What are this composite:facet without any composite:renderFacet for?

Xavier Portebois
  • 3,354
  • 6
  • 33
  • 53
  • Which JSF implementation are you using? Note since MyFaces 2.1.6/2.0.12 composite component cannot contains library names with slashes. Your library name is 'components/my', which is invalid. See [MYFACES-3454](https://issues.apache.org/jira/browse/MYFACES-3454) for details. – lu4242 Mar 16 '12 at 22:08
  • We're using Primefaces 3.2 and the Mojarra version provided by JBoss 7.1.1. We always used this kind of library names without any problem until the last JBoss version. – Xavier Portebois Mar 17 '12 at 14:24

2 Answers2

9

Valentinx in this thread found a workaround.

The idea is to put the faulty namespace declarations on the <composite:implementation> itself, so

<!DOCTYPE html PUBLIC ...>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:cc="http://java.sun.com/jsf/composite"
  xmlns:my="http://java.sun.com/jsf/composite/components/my" >
<cc:interface />
<cc:implementation>
     <my:nestedComponent content="a text" />
</cc:implementation>
</html>

becomes

<!DOCTYPE html PUBLIC ...>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:cc="http://java.sun.com/jsf/composite" >
<cc:interface />
<cc:implementation xmlns:my="http://java.sun.com/jsf/composite/components/my">
     <my:nestedComponent content="a text" />
</cc:implementation>
</html>

(notice the <cc:implementation xmlns:my="http://java.sun.com/jsf/composite/components/my"> tag)

This works like a charm!

Xavier Portebois
  • 3,354
  • 6
  • 33
  • 53
0

Thanks to Xavier for the answer: that is right on! I wanted to add comment, but don't have rep. to do that.

In my case, the problem is a little difference, with error on template (not in composite:implementation), and I found a solution that does not include <cc:implementation> ...

Instead, moved xmlns:layoutComp in template from <html> to a container (both 'div' and 'span' worked):

<span xmlns:layoutComp="http://java.sun.com/jsf/composite/layoutComp">
        <layoutComp:navigation />
</span>
Raymond Naseef
  • 171
  • 1
  • 7