I'm replacing a
Struts iterate tag with a JSTL forEach tag since I need to programmatically change the color of a table row depending on the value in one of the ArrayList's values.
The problem is, the forEach isn't working...nothing gets displayed.
==================================
Here's the breakdown:
==================================
I have a Struts FormBean called myBean in the session.
Inside that bean is an ArrayList called userList.
The ArrayList holds "userInfo" objects with three pieces of information about each user. Each userInfo object is a regular JavaBean with getter and setter for each of the three pieces of user information(getUserName, etc.).
In my JSTL code, I have the following declaration
(brackets removed for JavaRanch posting)
c:forEach items='${myBean.userList}' var='item'
tr
td c:out value='${item}'/ /td
/tr
c:forEach
------------
However, when this code runs, it produces nothing on the screen. I've tried various permutations (like just having '${myBean}', etc.).
The Struts action correctly shows over 50 user "userInfo" Bean objects in the userList ArrayList. (Also, the Struts iterate and bean:write tags worked on this page before I tried to substitute the forEach).
I'm guessing that I'm most likely not accessing each bean in the ArrayList correctly or something like that.
Can anyone see what's wrong with this logic above given my Struts form bean, ArrayList holding
Java Beans?
Thanks very much in advance!!!
- Mike