commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32347] New: - bean.propertyName does not evaluate correctly if the bean implements java.util.List
Date Mon, 22 Nov 2004 15:37:59 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32347>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32347

           Summary: bean.propertyName does not evaluate correctly if the
                    bean implements java.util.List
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: EL
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mac@donnell.com


I was using EL in a choose tag and could not get it to work at all on a 
particular page.  It worked on other pages, but on one particular page I kept 
getting errors no matter what I tried.  I would get errors like the following:

"${VistaTreeModelProxy.empty == false}" contains invalid expression(s): 
javax.servlet.jsp.el.ELException: Encountered "empty", expected one of 
[<IDENTIFIER>]
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError
(DefaultErrorHandler.java:39)
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch
(ErrorDispatcher.java:409)

After trying many different syntaxes, I got a trace of:
2004-11-22 09:28:16 ApplicationDispatcher[/JSF] Servlet.service() for servlet 
jsp threw exception
javax.servlet.jsp.el.ELException: The "." operator was supplied with an index 
value of type "java.lang.String" to be applied to a List or array, but that 
value cannot be converted to an integer.
	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:566)
	at org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:227)
	at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)


I downloaded the source and followed the stack-trace.  It looks as though the 
fact that my bean implemented java.util.List was causing the problem.  (This is 
the only difference I could really find from my identical use of the "choose" 
tag in other pages.)

>From what I have read, the dot-syntax should always try for a bean property, 
but this doesn't seem to work in the case of a List.  Also, using the 
["property"] syntax will also always try to coerce "property" into an integer.  
I am not sure if this is correct either, although what I have read is a bit 
ambiguous.

To work-around this, just don't use EL when it gets confused. The syntax below 
works:
<c:when test="<%= VistaTreeModelProxy.isEmpty() == false %>">

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message