tags:

views:

17

answers:

2

The below code is not working

<c:forEach var="row" varStatus="rowCount" begin="1" end="10">

 <c:set var="entry" scope="request" value="${session.entry.mileStones[rowCount.count]}"/>
 or

<c:set var="entry" scope="request" value="${entry.mileStones[rowCount.count]}"/>

</c:forEach>

where , Entry.getMileStones ====> HashSet is properly set in action class in session scope.

getSession().setAttribute("entry", entry);

Any idea..

A: 

You are using different scopes. Change scope to session.

ZZ Coder
+1  A: 

Some problems I see with the example provided:

  • As far as I know, JSTL and EL syntax doesn't work for sets, only maps. This makes sense, because there's no concept of retrieving the value for a key in a set (as the value is the key). Based the on the example you've provided, it looks like you might actually want the data structure to be either a list or a map.

  • It looks like you're trying to set a scoped value (entry) on the basis of the same value. Even if this will work, I doubt that it's what you want to do. Consider a different variable name for the second variable.

  • You can't iterate with a foreach without providing a collection to iterate over. There must be an items attribute with the foreach tag.

Sean Reilly