Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

foreach

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35762
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing my first page using JSTL core tags and am running into trouble. I have used EL a bit and custom/Struts tags extensively.



This code outputs:
Subject test
found one: ${post.subject}


The scriptlet shows that the value is in fact set in the servlet to have a subject. The c:forEach does recognize that there is one element in the loop. I can't figure out how to get it to output a field via a getter though. This seems like I'm missing something obvious.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65542
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like the EL is not getting evaluated. Do you have the web app set up properly using the Servlets 2.4 XML Schema in the deployment descriptor? (And using Tomcat 5 or 6?)
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35762
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Looks like the EL is not getting evaluated. Do you have the web app set up properly using the Servlets 2.4 XML Schema in the deployment descriptor? (And using Tomcat 5 or 6?)

Oh! It's using servlets 2.3. Which means I needed to add a line to the top of the JSP:


Thanks Bear!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!