Reputation: 11
When I try to access wrap.myUtilDate
I get an error:
`wrap.myUtilDate` cannot be resolved to a type
Can c:forEach
loop values be accessed from a scriptlet?
<c:forEach items="${myWraps}" var="wrap" varStatus="status">
<%
java.util.Date myUtilDate = wrap.myUtilDate;
org.joda.time.DateTime myJodaDate = new org.joda.time.DateTime(myUtilDate);
%>
<td><joda:format value="${myJodaDate}" style="LL"/></td>
</c:forEach>
Upvotes: 1
Views: 3035
Reputation: 62583
I think JSTL keeps the variables in either page
or pageContext
implicit objects. Just try both of them to be sure.
java.util.Date myUtilDate = ((MyWrap) pageContext.getAttribute("wrap")).myUtilDate;
Upvotes: 3
Reputation: 9858
If u get myWraps from the request, make like this
<c:forEach items="${requestScope.myWraps}" var="wrap" varStatus="status">
<%
java.util.Date myUtilDate = wrap.myUtilDate;
org.joda.time.DateTime myJodaDate = new org.joda.time.DateTime(myUtilDate);
%>
<td><joda:format value="${myJodaDate}" style="LL"/></td>
Upvotes: -2