简体   繁体   English

jsf:在jsp中进行迭代

[英]jsf: iterate in jsp

I am using jsf framework and want to iterate a list of Integers in jsp. 我正在使用jsf框架,并希望迭代jsp中的Integer列表。 The result should look something like the following: 1 2 3 4. 结果应类似于以下内容:1 2 3 4。

The tags datascroller and datalist does not work in my case and it seems like jsf isnt very compatible with jstl tags. 标记datascroller和datalist在我的情况下不起作用,似乎jsf与jstl标记并不十分兼容。 It stumbled upon x:iterator and x:forEach tag but didnt get it to work (actually the tags werent even recognized, so I must have missed some library, to begin with, but couldnt find out which library). 它偶然发现了x:iterator和x:forEach标签,但没有使它起作用(实际上,这些标签甚至都没有被识别出来,因此,我从一开始就一定错过了一些库,但找不到哪个库)。

Thanx for all help. 感谢所有帮助。

/Cissi /西西

The Core tags eg <c:forEach> should work as long as you aren't mixing them with JSF iterators - for example don't use them inside something like <h:dataTable> . 只要您不将它们与JSF迭代器混合,诸如<c:forEach>的Core标记就应该起作用-例如,请勿在<h:dataTable>类的东西中使用它们。 This is because the JSTL/Core tags are evaluated before any JSF iterator. 这是因为JSTL / Core标记是在任何JSF迭代器之前评估的。

Otherwise try something like Richfaces <a4j:repeat> or move away from JSPs and into Facelets (if you can, then definitely do this) and use <ui:repeat> 否则,尝试使用类似Richfaces <a4j:repeat>或者从JSP移到Facelets中(如果可以的话,一定要这样做),然后使用<ui:repeat>

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM