| Author |
Iterate arraylist with c:forEach
|
arona kosari
Greenhorn
Joined: Oct 28, 2006
Posts: 19
|
|
hi dears I use <c:foreach for an arraylist, but it does not work,like when list is empty.But I check being empty and know it's not.this is what I wrote: <c:foreach var="result" items="${list}"> <c ut value="${result}"/> </c:forEach> list is an ArryList which is fulled from database. Thanking you in anticipation Arona
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
c:forEach is part of the JSTL, not part of JSF. Specifically, it can cause you serious problems when used in conjunction with JSF. As you get more familiar with JSF, you'll discover that JSF pages don't have logic on them - they declare views, instead. For example, instead of iterating through a data array as c:forEach does, the JSF equivalent is a datatable, which simply specifies a window into the data array without actually defining the data retrieval in terms of a logic operation.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Edisandro Bessa
Ranch Hand
Joined: Jan 19, 2006
Posts: 584
|
|
Definitely JSF 1.1 does not work fine with JSTL. However, isn't JSF 1.2 supposed to support JSTL transparently ?
|
"If someone asks you to do something you don't know how to, don't tell I don't know, tell I can learn instead." - Myself
|
 |
XiaoPeng
Greenhorn
Joined: May 25, 2007
Posts: 3
|
|
|
I have had success combining JSTL with JSF in the past prior to discovering the h:dataTable tag. In your case, you need to specify which managed-bean the list is in, i.e. ${MyListBean.list}. And make sure you have a setter and a getter for 'list' implemented in MyListBean.
|
 |
pradip p sardar
Greenhorn
Joined: Nov 24, 2009
Posts: 5
|
|
Hi Everyone,
I would like to print the dynamic coulmn value using the t: dataTable . Is there any way by using var of dataTable we can display the collection value on screen. I dont want to display the text using var.name and var.address kind. I want to dynamically itereate over the row to get the values. Is there any simple way? Please let me know. Thanks. Pradip
|
 |
 |
|
|
subject: Iterate arraylist with c:forEach
|
|
|