• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSTL 1.0 : forEach error

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using JSTL <b>1.0</b>,

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:forEach var="eachObject" items="<%=allData%>">
<td><c ut value="${eachObject}" /></td>
<td><c ut value="${eachObject.Id}" /></td>
</c:forEach>

but the output is "${eachObject}" and "${eachObject.Id}". Sounds like it doesn't work. But I have jstl.jar there.

Thanks
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you try something simpler to see the tags work?

Did you try using ${ } instead of <%= %> ?



Your code snippet doesn't show what scope allData is declared in.

If you've got some existing jsp's and you're trying to slip in some jstl as a starting point, your allData list is probably declared in a scriptlet and is not visible using ${}. You can get around that a couple of different ways. One way to get things rolling is to use pageContext.setAttribute()...see code snippet:



[ May 23, 2005: Message edited by: Carol Enderlin ]
[ May 23, 2005: Message edited by: Carol Enderlin ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic