This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSTL c:forEach not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JSTL c:forEach not working" Watch "JSTL c:forEach not working" New topic
Author

JSTL c:forEach not working

Prithvi Sehgal
Ranch Hand

Joined: Oct 13, 2009
Posts: 774
Dear All,

I am going through chapter of JSTL in head first servlets and Jsp and i am trying to iterate through a collection of Employees
using JSTL c:forEach. This is the code





Here is the code for the Jsp



The strange thing is that the integer version of c:forEach is working but the below version is not. I am just showing the OR as an alternate
modification i did on the code. I don't know why it is not evaluating and not showing any values. Please help.

Another thing, i have noticed is, Employee list is coming as null. Any ideas why that is happening though i am setting list in session scope.

Please help.

BR,


Prithvi,
My Blog, Follow me on Twitter,Scjp Tips, When you score low in mocks, Generics,Scjp Notes, JavaStudyGroup
Prithvi Sehgal
Ranch Hand

Joined: Oct 13, 2009
Posts: 774
Hi Guys,

Please ignore this question, its working now. I solved the problem.

BR,
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5139
    
  12

Maybe you could share what you did to solve the problem? So other people with a similar problem can benefit from your experiences.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Prithvi Sehgal
Ranch Hand

Joined: Oct 13, 2009
Posts: 774
Dear Roel,

It was a pretty stupid thing over my part. It has no issues. Actually, i was reading this chapter in free time in office and the most dumb mistake i made
was, i was directly calling the jsp, not invoking the servlet. In that case, no attribute was made and list was obviously empty. So no mistake in code, actually
mistake from my end.

Thanks,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSTL c:forEach not working
 
Similar Threads
JSP, beans and sharing ArrayLists
Display data from database to jsp page.
value for the useBean class attribute Invalid Problem
Problem in accessing the Map in c:forEach loop of JSTL
Dropdown values not submitted