• Post Reply Bookmark Topic Watch Topic
  • New Topic

<c:forEach> not working properly

 
Alina Grimshaw
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two problems with this bit of code that may or may not be related.

First... I want to create a radio button for each element in from the bean array. I want the value of the of the radio button to be book.name but for some reason the name ends up being ${book.name} rather than the value of book.name. I don't know if it needs to be in a <c:set or something like that but what I've got is clearly not working.

The second problem I have, which could be related, is that for some reason, <c:out .../> only prints the very last element of the array. It prints the right number, like my bean array has 19 elements, but instead of printing all 19 elements, it prints the 19th element 19 times. I'm not sure that they would be related, but I thought maybe the radio buttons were messing up something.





the servlet code is as follows




Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like the EL isn't being properly evaluated. This is usually a sign of a misconfiguration or version mismatch. Have you worked through the JSP FAQ instructions on this issue?

Pay particular attention to:
  • Make sure that you are using the correct declaration for the deplyment descriptor for your version of Tomcat (or whatever).
  • Make sure you are using the right version of JSTL.
  • Make sure that you are using the right JSTL URI on your pages.
  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!