You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Elliot Metsger <em...@jhu.edu> on 2005/03/31 23:52:00 UTC

web-app version 2.4 and JSTL EL trouble

All,

I'm trying to use JSTL expression language in a portlet using servlet 
version 2.4 and Pluto 1.0.1rc2.

I've implemented the 2.4 workaround mentioned here: 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=pluto-user@portals.apache.org&msgNo=769

The workaround specifies turning off validation of web.xml and removing 
the namespace attributes etc. from the <web-app> element.  I've done 
that.  My Tomcat instance (5.0.28 Java 1.4.2) and webapps start 
smoothly, but when I try to access my application from Pluto it crashs 
and burns with:

SEVERE: PortletInvokerImpl.render() - Error while dispatching portlet.
javax.portlet.PortletException
         at 
org.apache.pluto.core.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:62)
         at 
edu.jhu.library.portalwg.hermes.HermesPortlet.doDispatch(HermesPortlet.java:143)
         at javax.portlet.GenericPortlet.render(GenericPortlet.java:178)
         at 
org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:205)
         at 
org.apache.pluto.core.PortletServlet.doGet(PortletServlet.java:145)

<snip>

Caused by: javax.servlet.jsp.el.ELException: Unable to find a value for 
"id" in object of class "java.lang.String" using operator "."
         at org.apache.commons.el.Logger.logError(Logger.java:481)
         at org.apache.commons.el.Logger.logError(Logger.java:498)
         at org.apache.commons.el.Logger.logError(Logger.java:611)
         at org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:340)
         at 
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)


The JSP that causes this error is:
   <c:forEach items="${subjects}" var="subject">
     <tr>
       <c:out value="${subject.id}"/>
       <td>

The 'subjects' object is a List exposed to the JSP via:
<%-- Expose the Hermes subject List so that we can get at the size and 
other properties of the List --%>
<jsp:useBean id="subjects" type="java.util.List" scope="request"/>

<%-- get the SubjectResource collection from the Portlet session and 
expose it --%>
<c_rt:set var="subjects" value="<% renderRequest.getPortletSession( 
).getAttribute( 'subjects' ) %>"/>

I know the 'subjects' object exists in the page because I can get 
expressions like:
<%= subjects.size( ) %>
to work fine in the page when I comment out the "bad" JSP.

Leading up to this I developed this application as a 2.4 servlet using 
JSTL.  Then I wanted to migrate it to a JSR 168 portlet.  So I made the 
necassary changes in the backend Java.  Then I updated my JSP to use 
<p:actionURL>'s and <p:renderURL>'s where appropriate.  But I'm having 
issues accessing custom bean classes like 'subjects' above, which is a 
List.  I didn't have problems accessing Collection objects before when 
using plain old servlets.

Any ideas or pointers would be very helpful at this point!

Thanks!
Elliot