ah ha.
jdk 1.4.2 :)

Well, i noticed that a similar method was working... and the trick was to
give them different names:

    public List getCostList() {
        return cost;
    }
    public String getCost(int index) {
        return (String) cost.get(index);
    }

This way,
${multipleProgrammesForm.costList[programme]} works fine
and <html:text property="cost[${programme}]"/> also works fine.

It seems that if you supply an indexed and non indexed method with the same
names, it gets all confused, and it tries to use the indexed method without
an index.

Thanks,

Daniel.

> -----Original Message-----
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]
> Sent: 23 February 2005 15:46
> To: Struts Users Mailing List
> Subject: Re: indexing with el
>
>
> 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]
>
>


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

Reply via email to