File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Problem with c:foreach not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with c:foreach not working" Watch "Problem with c:foreach not working" New topic
Author

Problem with c:foreach not working

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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?

Learning and Learning!-- Java all the way!
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Solved it! Must have been a typo : /
Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

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.


OCJP6, OCWCD5
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with c:foreach not working