JSTL: for Each loop to iterate over collection

java, jsp, jstl, spring

Solution

It looks like the object called "location" does not have an fEvents property. Is it actually called ftpEvents? Do you need to just change the variable name?

Even with that, though, you'll probably want to do something more like this:

 <c:forEach items="${location.ftpEvents}" var="item">
    <tr><td><form:input path="item.hostName" size="30" maxlength="200"/></td>
    <td><form:input path="item.directory" size="30" maxlength="200"/></td>
    <td><form:input path="item.userName" size="20" maxlength="20"/></td>
    <td><form:input path="item.password" size="20" maxlength="20"/></td>
    </tr>
 </c:forEach>

...you don't need to even use the loop.index at all, if I'm interpreting your code correctly.

Problem

following is my snippet, which was working good untill I migrated from spring 2 to spring 3 and Jstl 1.1 to jstl 1.2. Now, its not working and keep on giving the error `fEvents cannot found on object location` ``` <c:forEach items="${location.fEvents}" var="item" varStatus="loop"> <tr><td><form:input path="fEvents[${loop.index}].hostName" size="30" maxlength="200"/></td> <td><form:input path="fEvents[${loop.index}].directory" size="30" maxlength="200"/></td> <td><form:input path="fEvents[${loop.index}].userName" size="20" maxlength="20"/></td> <td><form:input path="fEvents[${loop.index}].password" size="20" maxlength="20"/></td> </tr> </c:forEach> ``` need to iterate the ftpEvents and show them on jsp Any suggestion is appreciated!!!

Original source