Hello all,
i know, at least in this forum i will get the answer........
here is the very basic question,but unfortunately i am unable to find out the mistake
as per my knowledge we can iterate collection in 2 ways (may be more..).
1st one is like :
a) set the collection in request as attribute in Action class
b) get the same in
jsp java.util.ArrayList employeeList = (java.util.ArrayList)request.getAttribute("employeeList");
c) then iterate it in jsp
<logic:iterate
collection="<%=employeeList%>" id="emp" type="com.risl.beans.Employee">
<tr>
<td><bean:write name="emp" property="empId"/></td>
...............
</tr>
</logic:iterate>
the second one is like
a) make one form-property as collection with getter-setter
b) populate it with data in Action Class
c) then iterate it in jsp
<logic:iterate
collection="employeeList" id="emp" type="com.risl.beans.Employee">
<tr>
<td><bean:write name="emp" property="empId"/></td>
...............
</tr>
</logic:iterate>
the question (more like a confusion) is in my projects ,
only the 1st one works well.
i have tries a lot for
2nd way......but it
always throws exception as
"cannot create iterator for this collection". Can any one help me out ?
[for info i am using
netbeans 5.5.1 with struts1.2.9 and tomcat 5.5.17]