Jacek Laskowski wrote:

Does anyone know what the following snippet does and why it doesn't work on Geronimo/Jetty? When I've uncommented the code within <%-- --%>, the page where you can place an order works, otherwise it does not. How could I pinpoint the root cause?

<c:forEach var="item" items="${pageResults.list}">
 <tr>
  <td class="petstore_listing">
   <c:url value="/item.screen" var="viewItemURL">
    <c:param name="item_id" value="${item.itemId}"/>
   </c:url>
   <a href='<c:out value="${viewItemURL}"/>'>
  <%--
    <c:out value="${item.attribute}" />
  --%>

I found the root cause, but did not a solution. It fails on Tomcat 5.5.9 (no Geronimo), too. When Item class (represented as the item variable, above) has two public methods - getAttribute() and getAttribute(int), Tomcat (and Jetty in Geronimo, which I think boils down to saying that it's Jasper or standard jstl impl, actually) prints out the following error message:

javax.servlet.jsp.el.ELException: Unable to find a value for "attribute" in object of class "coreout.Item" using operator "."
        org.apache.commons.el.Logger.logError(Logger.java:481)
        org.apache.commons.el.Logger.logError(Logger.java:498)
        org.apache.commons.el.Logger.logError(Logger.java:611)
        org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:340)
        org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
        
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
        
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190)
        
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:922)
        org.apache.jsp.index_jsp._jspx_meth_c_out_0(index_jsp.java:160)
        org.apache.jsp.index_jsp._jspx_meth_c_forEach_0(index_jsp.java:129)
        org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

When I remove the overloaded method with the int input argument, it works. How can I work it around? I wonder how it works on other application servers.

It seems it's not me who experiences the problem. I saw threads mentioning the same issue while deploying PetStore onto SJES and JBoss, e.g. http://forums.java.sun.com/thread.jspa?threadID=642376&tstart=120.

Jacek

Reply via email to