简体   繁体   中英

Composite Component in JSF 2.2 will not render

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

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.

Set your namespace correctly, and it should work:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM