> What's the property that it's failing on?... is it the monkeys[i]
property?...
> Can you show me the code of the bean for this property?...
Yes, it is the monkeys[i] property. If I delete the "age" and the select
"size", works fine
> Moving to session scope would mean you don't have to use the LazyList. The
> LazyList was devised to help people keep beans that use indexed properties
out
> of the session. But if you've put the beans into the session, then indexed
> problems shouldn't happen due to pre-population.
Sure!! but i've tried every advice i found in the mail-archive... and every
combinatory
of those advices ;)
How do you do in keyboardmonkey examples for not using LazyLists?
The jsp form (MonkeyTeamForm) : (very similar to nested-tutorial "monkey
with bananas")
----------------------------------------------------
<nested:form action="updateTeam">
<nested:write property="teamName"/>
[many more simple selects and texts boxes]
<nested:iterate property="monkeys">
<nested:write property="name"/>
<nested:text property="age" size="10"/>
<nested:select property="size">
<nested:options property="../sizesList"/>
</nested:select>
</nested:iterate> [if I delete "age" and "size" boxes, n.p.]
</nested:form>
-----------------------------------------------------
the involved Form Bean MonkeyTeamForm
-----------------------------------------------------
public class MonkeyTeamForm extends ValidatorForm implements Serializable{
private List monkeys = ListUtils.lazyList(new ArrayList(), new
MonkeyFactory());
private String teamName;
public void setMonkeys(Object[] newMonkeys){
// I tried too to initialize "monkeys" as a lazy list here too
for (int i = 0; i < newMonkeys.length; i++){
monkeys.add(newMonkeys[i]);
}
}
public Object[] getMonkeys(){
return monkeys.toArray();
}
public void setTeamName(String newTeamName){
teamName = newTeamName;
}
public String getTeamName(){
return teamName;
}
[many more getters and setters that works ok]
public void reset(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request){
tecnologias = ListUtils.lazyList(new ArrayList(), new MonkeyFactory());
}
public void reset(){
tecnologias = ListUtils.lazyList(new ArrayList(), new MonkeyFactory());
}
}
----------------------------------------------------
The monkey class (Monkey Team contains "Monkey"s)
----------------------------------------------------
public class Monkey implements Serializable {
private String name;
private long age; [ITS A PROBLEM TO BE "LONG"?]
private String size;
public void setTeamName(String newTeamName){
teamName = newTeamName;
}
public String getTeamName(){
return teamName;
}
public void setAge(long newAge){
age = newAge;
}
public long getAge(){
return age;
}
public void setSize(String newSize){
size = newSize;
}
public String getSize(){
return size;
}
}
---------------------------------------------------
big Thank you-Thank you
Daniel
----- Original Message -----
From: "Arron Bates" <[EMAIL PROTECTED]>
To: "Daniel Bl�zquez" <[EMAIL PROTECTED]>
Sent: Thursday, December 04, 2003 5:02 AM
Subject: Re: [struts-nested] BeanUtils.populate exception
> Daniel,
>
> What's the property that it's failing on?... is it the monkeys[i]
property?...
> Can you show me the code of the bean for this property?...
>
> Moving to session scope would mean you don't have to use the LazyList. The
> LazyList was devised to help people keep beans that use indexed properties
out
> of the session. But if you've put the beans into the session, then indexed
> problems shouldn't happen due to pre-population.
>
> This problem would still exist even if you used the indexed tags.
>
>
> Arron.
>
>
>
> > I have done rigth now a few more things but I still have the problem:
> >
> > - I have set the scope of the action to "session"
> >
> > - I have implemented the reset() method, instantiating collectiong
> > using a LazyList
> >
> > Maybe its recommendable to switch to Indexed properties? i only
> > wanted to do in the same way as Arron's monkey tree -so simple, and
> > cute-...
> >
> > but nothing works! :(
> >
> > Any ideas please?
> >
> > ----- Original Message -----
> > From: "Daniel Bl�zquez" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, December 02, 2003 5:55 PM
> > Subject: [struts-nested] BeanUtils.populate exception
> >
> > > Hi,
> > >
> > > I have been dealing with struts-nested taglibs for a few days (with
the
> > > unestimable help from Arron Bates in http://www.keyboardmonkey.com)
and
> > with
> > > the great amount of messages of this topic in the mailing list. But I
> > still
> > > have the next problem:
> > >
> > > javax.servlet.ServletException: BeanUtils.populate
> > > at org.apache.struts.util.RequestUtils.populate
RequestUtils.java:1254)
> > >
> > > (no extra info about ArrayIndexOutOfBounds or a more detailed
exception)
> > >
> > > when submitting a form that uses a nested collection of objects. Each
> > object
> > > is showing in the form a <select> and a <input text> box (as a form
> > showing
> > > monkeys, each monkey with a box for age and a <select> for size).
> > >
> > > <nested.form action="xxxx">
> > >
> > > <nested:iterate property="monkeys">
> > >
> > > <nested:write property="name"/>
> > > <nested:text property="age" size="10"/>
> > > <nested:select property="size">
> > > <nested:options property="../sizesList"/>
> > > </nested:select>
> > >
> > > </nested:iterate>
> > >
> > > </nested.form>
> > >
> > > The form also has many more properties (including checkboxes and
simple
> > > selects) but these ones work correctly.
> > >
> > > Things I have already done:
> > >
> > > -- Initialize involved property according to thread
> > >
> >
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]
> > > pache.org&by=thread&from=240019
> > > (thanks Arron again and Brandon)
> > >
> > > -- provide setter in the form for the nested property with the
signature:
> > > public void setMonkeys(Object[] newMonkeys)
> > >
> > > -- provide setter in nested monkey object for the size
> > > public void setSize(String newSize)
> > >
> > > I am really frustated because 'cant see what I am doing wrong!, any
help
> > > will be very appreciated
> > >
> > > TIA,
> > > 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]