[英]When <ui:repeat> works for X but <c:forEach> works for Y
I use <c:foreach>
in my jsf app to iterate over a list of people.我在我的 jsf 应用程序中使用
<c:foreach>
来遍历人员列表。 I don't use <ui:repeat>
because every person has its own tab (primefaces).我不使用
<ui:repeat>
因为每个人都有自己的选项卡(primefaces)。 JSF hero 'BalusC' already helped my out on this one link . JSF 英雄 'BalusC' 已经帮助我解决了这个链接。 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.这不适用于
<c:forEach>
,永远不会调用 Person 对象的适当设置器。 With <ui:repeat>
it works.使用
<ui:repeat>
它可以工作。 Obviously I haven't grasped the difference between the two tags so I would appriciate some enlightenment.显然我还没有掌握这两个标签之间的区别,所以我会得到一些启发。
Thanks谢谢
Marcel马塞尔
<c:forEach>
does not build JSF tree nodes on the server. <c:forEach>
不会在服务器上构建 JSF 树节点。 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"
.您可以直接在 html 中看到这一点,输入没有通常的长而独特的
id="j_12:customerTabPanel:j_34:customerName"
。
Please, read this:请阅读这个:
https://rogerkeays.com/jsf-c-foreach-vs-ui-repeat https://rogerkeays.com/jsf-c-foreach-vs-ui-repeat
<c:***>
tags are build-time tags, as <ui:***>
are rendered-time tags. <c:***>
标签是构建时标签,因为<ui:***>
是渲染时标签。 To get the difference between these two concepts, I recommand you to read the two links below:要了解这两个概念之间的区别,我建议您阅读以下两个链接:
<c:forEach>
vs <ui:repeat>
<c:forEach>
与<ui:repeat>
<ui:repeat>
does not work?<ui:repeat>
不起作用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.