I am trying to set up a simple JSP page on Tomcat 5.5.4 using JSTL-standards-1.1.2. Here is the problem I am having. I think it is a bug in commons-el.
My session scope contains an object (paginator) which has a property "itemsforpage" which returns a List:
I am trying to iterate over this list like this:
When I try to access the page, I am getting an exception:
which says that it doesn't know how to iterate over the items I specified. ${paginator.itemsforpage}. I did some debugging and I found that the object it is dealing with is actually of type Paginator (not List)!!
It is as if I had items="${paginator}" instead of items="${paginator.itemsforpage}". However, the paginator.getItemsforpage() method is getting called.
1) Why is commons-el evaluating this expression to the wrong object? I think this is a bug.
2) Why is it using that commons-el expression evaluator (comes with Tomcat) instead of JSTL 1.1? Can I force it to use the real JSTL standards.jar?
Thanks Geoffrey
Sun Certified Programmer for the Java 2 Platform
Geoffrey Falk
Ranch Hand
Joined: Aug 17, 2001
Posts: 171
posted
0
PS I tried this with Tomcat 5.0.30 and had the same problem.
Geoffrey Falk
Ranch Hand
Joined: Aug 17, 2001
Posts: 171
posted
0
To answer my own question, in case anyone comes here with the same problem..
I found the problem. It was not the <c:forEach> tag. It was something in a completely different area of the page. I had this in my JSP:
which is wrong because "paginator" is not a collection. I should have had:
with this it works fine.
BUT: The real problem is that the error message is extremely misleading!! The problem had nothing to do with <c:forEach>, yet the error message indicated that it did!! This cost me 6 hours of time!!!
Someone should really fix this misleading error message!!!