Originally posted by John Wetherbie:
<c:forEach var="msg" items="$page:msgs">
<tr bgcolor="#FFFFFF">
<td class="<%= rowType %>" height="19"><c:out value="$msg"/></td>
</tr>
</c:forEach>
</table>
Hi John. You're close, but the syntax you're using has been out of date for quite some time; it belongs to a very preliminary "early access" draft of the specification. (Some books oddly covered this syntax even though the draft was widely publicized as being preliminary and prone to change.)
Instead of "$page:msgs", you want to say "${pageScope.msgs}". Instead of "$msg", you want "${msg}". JSTL expressions begin with "${" and end with "}".
Also, the way you're using <c:set> in your example
is questionable. It sets the variable "msgs" to the literal string "msgs", which is probably not what you want. You probably mean to add the line
pageContext.setAttribute("msgs", msgs);
in your scriptlet block. For a variety of reasons, <c:set> is not a good conduit between scripting variables and scoped variables (called "scoped attributes" in older JSP specifications).
Please let me know if you have any other questions. The JSTL spec is available from
http://java.sun.com/products/jstl, and my book ("JSTL in Action") will be out shortly.
[ July 29, 2002: Message edited by: Shawn Bayern ]