Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL c:out not working but other commands working

 
Anand Athinarayanan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a problem in dislaying values using the JSTL <c:out> tag. I have a request scoped attribute which is a arraylist containing objects. The objects has properties (corresponding getter setters) which is to be displayed in the jsp page. It is in the display part that I face the issue.

I'm able to retrieve the objects from the list because when I used a <c:if to check for a condition it is working perfectly.

<c:forEach var ="foo" items="{list}"> Assume that list is a arraylist containing bar objects which has properties name and id.

Now when I do this
<c:out value="{foo.name}"> </c:out>. In my JSP it prints foo.name instead of the value of the name but if i do this "{foo.name}" it correctly prints the value of the name say John or whatever.

What am i doing wrong here?

My jsp is deployed on a weblogic 9.2 server, I'm using JSTL 1.1 , so I have both jstl.jar and standard.jar in web-inf/lib. My web.xml is also defined as per the JEE 1.4 specification.
I have imported this - <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> in my jsp page.

Is it possible that only <c:out> wouldn't work? I fear not but its weird. Any help?


Thanks
Anand



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot the $:
 
Anand Athinarayanan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aah Ha!. Got it now. Thanks Bear. Marking it as resolved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic