Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with c:foreach not working

 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Im trying to display a list that I populate from the database on my jsp.Im relatively new to programming and so am faced with an issue.
Currently I use a list of beans that stores the values obtained through a select query, each of the beans represents a row in the table. Im trying to use a c:foreach loop to display the values that i have stored in the bean .
This is the loop i use on the jsp.


The corresponding DAO code fragment

Could anyone kindly help with where Im going wrong?
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved it! Must have been a typo : /
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you never explained what is going wrong. I assume that you intend to display the code, description, and statusActive in a table. Are you receiving any errors? Is the rest of the page loading? Have you verified that the getDomList() is returning a valid List with actual DomainBeans inside? Why is your property method (getDomList) declaring that it throws an exception? What is the code for your DomainBean? Are the getter methods properly matched with your EL expression? I.E. do you have a getCode(), getDescription(), and getStatusActive() methods (remember that capitalization is important). Looking at your code, it looks like you are also missing the opening and closing tags for the <table> element.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for replying Mike!
Earlier I really dont know what I was doing wrong but the c:foreach wouldn't even show up in my source html.I guess I wasnt setting a bean variabel of domList earlier , however after that change it does work!
Thanks for replying
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic