Are you using JDK 1.4? JDK 1.4 will ignore the getCost() method that returns
a java.util.List, if you change it to an array then it will consider that
method part of the indexed property and everything will probably work. It
probably would work under JDK 1.3, but Sun tightened up on how it treats
indexed properties.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28358#c14

Niall

----- Original Message ----- 
From: "Daniel Perry" <[EMAIL PROTECTED]>
To: "Struts User List" <user@struts.apache.org>
Sent: Wednesday, February 23, 2005 3:05 PM
Subject: indexing with el


> Hi,
>
> I'm trying to create a form which uses indexed properties.
>
> My bean has two (amongst others) methods:
>     public List getCost() {
>         return cost;
>     }
>
>     public String getCost(int index) {
>         return (String) cost.get(index);
>     }
>
> In the form i use the above:
>
> <c:forEach begin="0" end="${multipleProgrammesForm.numberOfProgrammes-1}"
> var="programme">
> <html:text property="cost[${programme}]" size="5"/>
>
> And it is all fine and dandy!
>
> I also need to obtain this value in jstl-el:
>
> I've tried:
> ${multipleProgrammesForm.cost[programme]}
> gives:
>
> javax.servlet.jsp.el.ELException: Unable to find a value for "cost" in
> object of class "com.netcase.pdp.admin.actionform.MultipleProgrammesForm"
> 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)
>
> But, i've also tried obtaining the list on it's own using:
> <c:set var="cost" value="${multipleProgrammesForm.cost}"/>
> and that gives the same error - suggesting that it's trying to use the
> indexed getter.
>
> Any ideas how i can get this value?  Am i going to have to result to
> scriptlets?
>
> Thanks,
>
> Daniel.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to