Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JSTL c:forEach not working" Watch "JSTL c:forEach not working" New topic

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.


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.

Roel De Nijs

Joined: Jul 19, 2004
Posts: 8408

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
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.

I agree. Here's the link:
subject: JSTL c:forEach not working
jQuery in Action, 3rd edition