当< ui:repeat>适用于X但是< c:forEach>为Y工作 [英] When <ui:repeat> works for X but <c:forEach> works for Y
问题描述
我在我的jsf应用中使用< c:foreach>
来迭代人员列表。我不使用< ui:repeat>
,因为每个人都有自己的标签(primefaces)。 JSF英雄'BalusC'已经帮助我完成了这个链接。现在我尝试保存(回发)数据。这不适用于< c:forEach>
,从不调用Person对象的approriate setter。使用< ui:repeat>
可行。显然我没有理解这两个标签之间的区别,所以我会赞美一些启示。
I use <c:foreach>
in my jsf app to iterate over a list of people. I don't use <ui:repeat>
because every person has its own tab (primefaces). JSF hero 'BalusC' already helped my out on this one link. Now I tried to save (postback) the data. This doesn't work with <c:forEach>
, the approriate setter of the Person object gets never called. With <ui:repeat>
it works. Obviously I haven't grasped the difference between the two tags so I would appriciate some enlightenment.
谢谢
Marcel
推荐答案
< c:forEach>
不构建JSF树服务器上的节点。您可以直接在html中看到这一点,输入不具有通常的长且不同 id =j_12:customerTabPanel:j_34:customerName
。
<c:forEach>
does not build JSF tree nodes on the server. You can see this directly in the html, the inputs do not have the usual long and distinct id="j_12:customerTabPanel:j_34:customerName"
.
请阅读:
http://www.ninthavenue.com.au/blog/c:foreach-vs-ui:repeat-in- facelets
这篇关于当< ui:repeat>适用于X但是< c:forEach>为Y工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!