Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL looping problem  RSS feed

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have some problem with JSTL forEach with collections.
I can not understand what the problem really is. When sending a collection over to the JSP I get an exception when I try to loop through it with an c:forEach.

I have tried with both JSTL 1.1.2 JSP 2.0 and JSTL 1.2 and JSP 2.1 with same result.

I am running in a Jetty server. I have been developing the application using IBM RAD and WebSphere and have recently moved som code over the Jetty version of the same application. It was then the problem occured. I can not go back since the jetty version of the application is not in SVN nor does I have a local backup. So I have to figure out what the problem is.

All the information the exception message gives me is that the problem lies with the c:forEarch tag. I can not find the underlying problem why it will not work.

Outputing the collection using ${} gives me the items in that collection, but if I put it in a forEach I get the following exception.


javax.servlet.ServletException: java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
at org.apache.jsp.jsp.bank.bank_002ddetails_jsp._jspService(org.apache.jsp.jsp.bank.bank_002ddetails_jsp:1191)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE:

I realized that my web.xml was using Servlet 2.4 and I changed it to 2.5.

Then I tried running the application again, but this time JSTL will not work. Any simple ${var} is outputed as text.

This time I also tried a simple c:set
<c:set value="This is a test" var="test"/>

${test }

It gave the same exception as previously.

This one works fine when I go back to Servlet 2.4 in the web.xml descriptor. But the Jetty server I am runing is using servlet-api-2.5


Edit: Solved
[ May 13, 2008: Message edited by: Sverre Moe ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!