struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Perry" <d.pe...@netcase.co.uk>
Subject indexing with el
Date Wed, 23 Feb 2005 15:05:10 GMT
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message