JSF2 EL 未显示在组件 ID 中

2024-02-10

我有以下代码:

<ui:repeat var = "ctr" value = "#{bean.counterList}">
    <h:outputLabel for = "message#{ctr}" value = "#{appMessage['No #{ctr} :" />
<h:inputText id="message#{ctr}" value="#{bean.messageList}" />
</ui:repeat>

The counterList is an List<String>。如果列表包含1, 2, 3在视图中,您应该有 3 个带有 ids 的输入字段:message1, message2, message3.

EL 没有影响id属性和所有组件只接收message作为身份证件。另一方面,就标签的价值而言,EL 效果很好。

我可以想象这可能是期望的行为,但是有解决方法吗?

UPDATE:

我删除了id属性和ui:repeat现在负责命名 id。从源代码中我可以看到生成的 ID 是唯一的,但现在抛出此警告:

INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
sourceId=fm-story:j_idt103:0:j_idt54[severity=(ERROR 2), summary=(Conversion Error setting value '' for 'null Converter'.), detail=(Conversion Error setting value '' for 'null Converter'.)]
sourceId=fm-story:j_idt103:1:j_idt54[severity=(ERROR 2), summary=(Conversion Error setting value '' for 'null Converter'.), detail=(Conversion Error setting value '' for 'null Converter'.)]

这里描述了您要解决的问题JSF/Seam 中的动态 ID https://stackoverflow.com/questions/316790/dynamic-ids-in-jsf-seam和这里http://illegalargumentexception.blogspot.com/2009/05/jsf-using-component-ids-in-data-table.html http://illegalargumentexception.blogspot.com/2009/05/jsf-using-component-ids-in-data-table.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

JSF2 EL 未显示在组件 ID 中 的相关文章

随机推荐