struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Connor <brettcon...@spamcop.net>
Subject Re: Basic JSTL <c:forEach not working
Date Wed, 01 Sep 2004 13:53:32 GMT
xxx needs to be somewhere accessible to the c:forEach tag. Do a search 
on scoped variables. This can be done in your scriptlet or in the action 
that forwards to this jsp.
Brett

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
>
>

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


Mime
View raw message