0

有没有办法将 bean 操作作为ui:repeat我的 JSF 2.2 页面内的自定义标记的属性传递?

<ui:repeat value="#{list}" var="item">
    <custom:component action="#{abean.method}" id="#{item.id}"/>
</ui:repeat>

然后在自定义标签内:

<h:form>
    #{id}
    <h:commandButton value="say hi" action="#{action}"/>
</h:form>

这将给出错误消息:

action="#{action}": Identity 'action' was null and was unable to invoke

id 出现了,所以如果我理解正确,我的自定义组件会在构建期间添加一次,然后在渲染期间为每个项目回收组件(从而分配正确的 id)。但是,为什么不将动作解释为参数超出了我的范围,我想澄清一下原因。我只能传递字符串吗?

4

0 回答 0