[jboss-user] [Beginners Corner] - foreach (= advanced for) in JSPS
MarcusDidiusFalco
do-not-reply at jboss.com
Wed Jun 27 04:59:52 EDT 2007
Hallo!
I have tried to use foreach (= advanced for) in JSPs
<% for (Order order: orders.getOrders()) { %>
| <tr><td><%= order.getItem() %></td><td><%= order.getPrice() %></td><td><%= order.getNumber() %></td></tr>
| <% } %>
This works fine with Tomcat 5.5.23, however when deploying the same war to JBoss 4.0.5 GA I get the following exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 19 in the jsp file: /test.jsp
Generated servlet error:
Syntax error, 'for each' statements are only available if source level is 5.0
An error occurred at line: 19 in the jsp file: /test.jsp
Generated servlet error:
Can only iterate over an array or an instance of java.lang.Iterable
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
I thought JBoss uses Tomcat 5.5 as a Servlet container. So why this difference?
Thanx,
Hans
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4058014#4058014
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4058014
More information about the jboss-user
mailing list