This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Problem with c:foreach not working

 
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • 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 Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved it! Must have been a typo : /
 
Ranch Hand
Posts: 144
Oracle Fedora Java
  • 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 Tomcat Server Java
  • 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
 
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!