You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Charles Canning <cc...@ccanning.com> on 2003/07/31 19:54:41 UTC
[OT] Problem with JSTL (using struts)
Hey,
Sorry to send this to this list. If someone can recommend a better source
for help, please do. I am using JSTL and struts-el in a form, but the
foreach is not returning my values. If I use a scriplet, I see them. Here is
the scenario/code in same JSP
<%
List alist;
Iterator iterator;
MessageHeader mHeader;
alist = (List)request.getAttribute("headerList");
//get the iterator
iterator = alist.iterator();
//step through
while (iterator.hasNext() == true) {
mHeader = (MessageHeader)iterator.next();
%>
sender <%=mHeader.getSender()%><br>
subject <%=mHeader.getSubject()%><br>
messageId <%=mHeader.getMessageId()%>
<%
}
%>
<c:forEach items="${headerList}" var="header">
<c:choose>
<c:when test="${index} % 2 == 0">
<TR bgcolor="FFEDED">
</c:when>
<c:otherwise>
<TR bgcolor="FFD8D8">
</c:otherwise>
</c:choose>
<td>
<c:out value="${header.sender}"/>
<c:out value="${header.subject}"/>
<c:out value="${header.messageId}"/>
<html-el:multibox property="values" value="${header.messageId}"/>
</td>
<td align="left" width="25%" class="subtext">
<c:out value="${header.sender}"/>
</td>
<td align="left" width="50%">
<c:out value="${header.subject}"/>
</td>
<td align="right" width="25%">
<fmt:formatDate value="${header.date}" type="BOTH" dateStyle="LONG"
timeStyle="MEDIUM"/>
</td>
</tr>
</c:forEach>
The scriplet shows all the fields, the JSTL/el tags show no values, but it
does have do the correct number of iterations through the list.
Any help would be greatly appreciated.
Chuck
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org