struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "andy wix" <stix...@hotmail.com>
Subject Basic JSTL <c:forEach not working
Date Wed, 01 Sep 2004 13:45:30 GMT
Hi,

In trying to resolve another (more Struts related!) problem someone 
suggested using a <c:forEach tag, but I can't get it to output anything to 
the screen.  I have omitted the html for clarity but have created a simple 
class called test that has 1 instance variable called name and a getter and 
setter.

<%@ taglib uri="jstl/c" prefix="c" %>

<%
  Test con1 = new Test();
  Test con2 = new Test();
  con1.setName("Fred");
  con2.setName("Dog");

  ArrayList xxx = new ArrayList();
  xxx.add(con1);
  xxx.add(con2);
%>

<c:forEach items="${xxx}" var="temp">
   Name: <c:out value="${temp.name}" />
</c:forEach>

Should this ouput the 2 names to the page?
I can do a <c:out successfully on its own so I suspect the taglib is seen 
correctly.

Thanks,
Andy

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message