小编Run*_*ein的帖子

具有复合子元素的复合组件与ui一起使用时将值混合:重复

我试图通过嵌套一个孩子来使两个复合组件很好地协同工作.该设置包含一个灯箱和一个带有名为"Value"的属性的输入.这工作正常,直到我引入动态数量的输入,因此必须使用ui:repeat.

bugTest.xhtml

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

    <h:head></h:head>
    <h:body>
        <pw:lightBox value="Header">
            <h:form>
                <ui:repeat var="input" value="#{BugTestBean.inputs}">
                    <pw:bugTestInput value="#{input}" />
                </ui:repeat>
            </h:form>
        </pw:lightBox>
    </h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

ui:repeat似乎混淆了两个组件的value属性,并发生以下异常.

Caused by: javax.el.PropertyNotFoundException: /resources/components/bugTestInput.xhtml @15,62 value="#{cc.attrs.value.text}": The class 'java.lang.String' does not have the property 'text'.
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:170)
at javax.faces.component.UIInput.getValue(UIInput.java:284)
at com.sun.faces.facelets.component.UIRepeat$SavedState.populate(UIRepeat.java:879)
at com.sun.faces.facelets.component.UIRepeat.saveChildState(UIRepeat.java:396)
at com.sun.faces.facelets.component.UIRepeat.saveChildState(UIRepeat.java:402)
at com.sun.faces.facelets.component.UIRepeat.saveChildState(UIRepeat.java:402)
at com.sun.faces.facelets.component.UIRepeat.saveChildState(UIRepeat.java:356)
at com.sun.faces.facelets.component.UIRepeat.setIndex(UIRepeat.java:470)
at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:586)
at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:1042)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1819)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
at …
Run Code Online (Sandbox Code Playgroud)

jsf facelets composite-component jsf-2 uirepeat

6
推荐指数
1
解决办法
1171
查看次数

标签 统计

composite-component ×1

facelets ×1

jsf ×1

jsf-2 ×1

uirepeat ×1