简体   繁体   中英

EL in composite component on Mojarra

help me with problem.

I use Mojarra 2.1.16 and Tomcat 7.

I have composite component:

<composite:interface>
    <composite:attribute name="value" default="#{modelsBean.allModels}"
                         type="java.util.List" />
</composite:interface>

<composite:implementation>
    <ui:repeat value="#{cc.attrs.value}" var="model" >
        #{model.name}
    </ui:repeat>
</composite:implementation>

If I use it, then I have next error:

javax.el.PropertyNotFoundException: /resources/panels/modelsView.xhtml
#{model.name}: Property 'name' not found on type java.lang.String

If I change

<ui:repeat value="#{cc.attrs.value}" var="model">

to

<ui:repeat value="#{modelsBean.allModels}" var="model">

then all work ok.

How to fix then?

You can not assign a value expression as default value. See here for a more detailed explanation: JSF composite component backing bean EL expression as default of required attribute failing, methods not known

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