简体   繁体   English

什么时候<ui:repeat>适用于 X 但<c:forEach>为 Y 工作

[英]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:要了解这两个概念之间的区别,我建议您阅读以下两个链接:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 替换c:foreach on ui:repeat - Replace c:foreach on ui:repeat JSF 中的递归(c:forEach 与 ui:repeat) - Recursion in JSF (c:forEach vs. ui:repeat) c:forEach vs ui:repeat(又名 ice:panelSeries) - c:forEach vs ui:repeat (a.k.a ice:panelSeries) javac -cp src\x\y\z src]x\y\z\*.java 有效但 javac -cp src\x\y\z src\x\y\z\MainClass.java 失败 - javac -cp src\x\y\z src]x\y\z\*.java works but javac -cp src\x\y\z src\x\y\z\MainClass.java fails 处理:使用四元数旋转3D对象适用于x轴,但不适用于y或z轴吗? - Processing: Rotating a 3D object using Quaternions works for x-axis, but not for y or z axis? 无法使c:forEach和c:out工作(我得到一个空白页) - Can't make c:forEach and c:out works (I get a blank page) 给定int X,找到Y,使得(X + Y)是二进制格式的pallindrome。适用于12345以下的值,不适用于123456及以上的值 - given int X,find Y such that (X+Y) is pallindrome in binary format.works fine with values upto 12345 not working with values 123456 and above IO例外,我的输入数据为x,y的程序有时可以正常工作而没有任何错误,并且有时有时无法使用相同的x,y输入数据 - IO Exception, my program with input data of x,y sometimes works without any error and randomly sometimes doesnt work with the same x,y input data forEach()方法在Java 8中如何工作 - How does forEach() method works in Java 8 foreach 如何处理 JSP 中的列表列表 - How foreach works for List of Lists in JSP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM