struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Siggelkow <bills...@bellsouth.net>
Subject Re: Basic JSTL <c:forEach not working
Date Wed, 01 Sep 2004 15:16:42 GMT
Okay, Andy -- JSTL operates on scoped variables not scripting variables. 
You are trying to access scripting variables. I found this good primer 
on JSTL that explains this at 
http://www-106.ibm.com/developerworks/java/library/j-jstl0211.html

andy wix wrote:
> 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