> Could not get the wiki's example of
> 
> public class SkillActionForm extends ActionForm {
>       protected List skills = new ArrayList();
> 
>       public List getSkills() {
>           return skills;
>       }
> 
>       public void setSkills(List skills) {
>           this.skills = skills;
>       }
> 
>       public SkillBean getSkills(int index) {
>           // automatically grow List size
>           while (index >= skills.size()) {
>               skills.add(new SkillBean());
>           }
>           return (SkillBean)skills.get(index);
>       }
>   } 
> 
> However, as soon as I changed the setSkills(List) to
> setSkills(SkillBean) and provided a non-bean collection 
> populating method (populateSkills(List)) everything seems to 
> work. Apparently Struts is/cannot examine the method 
> arguments and is confused by the naming.

I just went through a lot of grief with indexed properties. The Java Beans
spec says that accessor methods for indexed properties have the following
signatures:

public myobj[] getProperty()
public void setProperty(myobj[] mo)
public myobj getProperty(int i)
public void setProperty(int I, myobj mo)

The unindexed accessors must take and return an array, no other kind of
collection will do.

My problem was that the BEA Weblogic server on my local computer has a JVM
that does not enforce that rigorously, and is perfectly happy with unindexed
accessors that take other kinds of collections. But once I've got my app
working on my own machine, I deploy it to a larger machine that's available
to the testers and users. And that machine's JVM will not recognize an
indexed property if the unindexed accessors use anything other than an
array. I was using an ArrayList, and that caused the server to tell me that
the property did not exist!

--
Tim Slattery
[EMAIL PROTECTED]


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

Reply via email to