You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ian Hunter <ih...@hunterweb.net> on 2003/02/24 19:41:14 UTC
(No longer OT) Accessing individual array elements
So as it works now, do you have
public int setValue(int index, String value)
and
public int setValues(ArrayList values)
or do you have
public int setValues(int index, String value)
and
public int setValues(ArrayList values)
? My theory is that the introspection will croak utterly if you have two
methods called setValue() even if they take different arguments.
Also, why are you returning values from a "setXxxx" method? Shouldn't they
be void methods?
----- Original Message -----
From: "Robert Leland" <rl...@apache.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, February 24, 2003 1:31 PM
Subject: Re: [OT] (Slightly OT) Accessing individual array elements (was Re:
<html:select> "multiple" problems)
> If I have in a Form
> class AForm extends ActionForm {
>
> ArrayList values;
>
> public int getValue(int index) {
> return value.get(index);
> }
> public int setValue(int index,String value) {
> return value.set(index,value);
> }
> //-- This also could have been getValueList(), just be consistent.
> ArrayList getValues() {
> return values;
> }
> void setValues(ArrayList values) {
> this.values = values;
> }
> }
>
> I had an ActionForm just 2 days ago that had
> ArrayList getValue();int getValue(int index), void setValue(int index,
> String value)
>
> It had worked for over a year, but really wasn't a
> valid bean, because of the ArrayList items.
> However with the latest version of beanutils,
> the int setValue(int index,String value) method couldn't be found.
>
> I guess that beanutils tightened up on their introspection,
> and once ArrayList getValue() was renamed, everything worked again.
>
>
> -Rob
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org