struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Canning" <ccann...@ccanning.com>
Subject [OT] Problem with JSTL (using struts)
Date Thu, 31 Jul 2003 17:54:41 GMT
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


Mime
View raw message