Pregunta

I migrated a project from myfaces 2.1 to 2.2, and now my composite component will not render.

The page output shows:

<meg:megamenu menubean="ec.common.WetTopMenuBarBean@183817e" id="topMenuLevel0" />

Where the me:megamenu should be expanded into the rendered html.

It all worked in myfaces 2.1. Does anyone have any ideas?

The structure is basically a page, that uses a template, that ui:include another reusable content, which then uses the composite component.

The page:

<ui:composition template="/templates/wetLayout.xhtml" >

The template:

<ui:include src="#{chosenTheme == 'intranet' ? '/sections/common/intranet/commonHeader.xhtml' : '/sections/common/commonHeader.xhtml'}" >    

The sub section:

...
xmlns:meg="http://xmlns.jcp.org/jsf/composite/components/topNav"
...
<meg:megamenu id="topMenuLevel0" menuBean="#{wetTopMenuBarBean}"    />

I have also tried it with both eclipse Juno and Kepler.

Thanks,

Dan

¿Fue útil?

Solución

I tried this in an example of my own and you are right: It is not possible to use composite components in sub directories by default. As Leonardo pointed out in a comment to the question, this is not allowed in the JSF spec.

In MyFaces, however, this behavior can be changed by setting the context parameter org.apache.myfaces.STRICT_JSF_2_ALLOW_SLASH_LIBRARY_NAME to true.

With this parameter set, I can use composite components in sub directories with MyFaces 2.2.0.

Otros consejos

Set your namespace correctly, and it should work:

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top