• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Problem with c:foreach not working

 
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Slime does not pay. Always keep your tiny ad dry.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic