myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Carlson" <>
Subject RE: iterating over a list of items
Date Mon, 03 Aug 2009 21:30:49 GMT
Ui:repeat can be used in faces markup (.jspx?)  There are cases when you
need to use c:forEach instead of ui:repeat.


Perhaps you should look for a dynamic menu that takes a collection.   Or
build your menu in Java code (use or subclass a component in your code).




From: Scott Carter [] 
Sent: Monday, August 03, 2009 2:11 PM
To: MyFaces Discussion
Subject: iterating over a list of items


I know this subject is discussed in several places on the web, but I would
like to get an updated expert opinion.  I need to iterate over a list of
items defined in a backing bean.  In my case I am using the items in the
list to construct a menu in richfaces so I will need to be able to iterate
the list and define variables for each item to access the attributes.  


The 2 ways discussed from Google searches of achieving this are the facelets
ui:repeat tag and the jstl c:foreach tag.  As I understand it the facelets
ui:repeat tag can not be used in a jsp page, which is what I am using (jsp).
If I even try to include this tag, it is not found regardless if I have the
facelets jar in my WEB-INF/lib directory.  


The c:foreach has several sites of documentation on what a bad idea it is to
use jstl tags in JSF pages.  


So I am left asking the question, what is the best way to do this?  Any good
code examples or links would be very appreciated as well as advice on a best
practice here.  


Thanks in advance.    

View raw message