You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by William Salvucci <Wi...@dn.netl.doe.gov> on 2003/03/05 14:58:12 UTC
Wrapping Collections in LazyList to auto-populate form on
Submit
>From the BananaBean example, I put the following in a nested:form
<nested:iterate property="bananas">
<nested:text property="flavour"/>
</nested:iterate>
and get this exception:
java.lang.IllegalArgumentException: Property 'bananas' is not indexed
In the form I construct the bananas list using
private List bananas = ListUtils.lazyList(new ArrayList(),
new Factory()
{
public Object create() {
return new BananaBean();
}
});
In the display action I populate the list using bananas.add
Re: Wrapping Collections in LazyList to auto-populate form onSubmit
Posted by alexj <al...@freesurf.ch>.
It's not a good conception that an List can be indexed (an Collection to)
....that's suck...
an ArrayList ok but not a simple List... (a simple List don't use an array
as
the internal structure) but for an iterator it's song ok.
But that's my opinion Java data structure are really strange.
--
Alexandre Jaquet
----- Original Message -----
From: "Brandon Goodin" <ma...@phase.ws>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, March 05, 2003 3:50 PM
Subject: RE: Wrapping Collections in LazyList to auto-populate form onSubmit
> That's wierd. I use the LazyList all the time and do not run in to that
> problem. Did you try using jstl to see if the problem is perhaps somewhere
> else.
>
> You will need to import the jstl core taglib and the struts html-el tag
> libs.
>
> <c:forEach items="requestScope.[you form name].bananas" var="bannana"
> varStatus="status">
> <html:text property="bannans[${status.index}].flavour"/>
> </c:forEach>
>
> Have Fun,
> Brandon Goodin
> Phase Web and Multimedia
> PO Box 85
> Whitefish MT 59937
> P (406) 862-2245
> F (406) 862-0354
> mail@phase.ws
> http://www.phase.ws
>
>
> -----Original Message-----
> From: alexj [mailto:alexj@freesurf.ch]
> Sent: Wednesday, March 05, 2003 7:05 AM
> To: Struts Users Mailing List
> Subject: Re: Wrapping Collections in LazyList to auto-populate form
> onSubmit
>
>
> Use Collection instead than List (a list is not indexed)
>
> --
> Alexandre Jaquet
>
> ----- Original Message -----
> From: "William Salvucci" <Wi...@dn.netl.doe.gov>
> To: <st...@jakarta.apache.org>
> Sent: Wednesday, March 05, 2003 2:58 PM
> Subject: Wrapping Collections in LazyList to auto-populate form onSubmit
>
>
> From the BananaBean example, I put the following in a nested:form
>
> <nested:iterate property="bananas">
> <nested:text property="flavour"/>
> </nested:iterate>
>
> and get this exception:
>
> java.lang.IllegalArgumentException: Property 'bananas' is not indexed
>
>
> In the form I construct the bananas list using
>
> private List bananas = ListUtils.lazyList(new ArrayList(),
> new Factory()
> {
> public Object create() {
> return new BananaBean();
> }
> });
>
> In the display action I populate the list using bananas.add
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: Wrapping Collections in LazyList to auto-populate form onSubmit
Posted by Brandon Goodin <ma...@phase.ws>.
That's wierd. I use the LazyList all the time and do not run in to that
problem. Did you try using jstl to see if the problem is perhaps somewhere
else.
You will need to import the jstl core taglib and the struts html-el tag
libs.
<c:forEach items="requestScope.[you form name].bananas" var="bannana"
varStatus="status">
<html:text property="bannans[${status.index}].flavour"/>
</c:forEach>
Have Fun,
Brandon Goodin
Phase Web and Multimedia
PO Box 85
Whitefish MT 59937
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws
-----Original Message-----
From: alexj [mailto:alexj@freesurf.ch]
Sent: Wednesday, March 05, 2003 7:05 AM
To: Struts Users Mailing List
Subject: Re: Wrapping Collections in LazyList to auto-populate form
onSubmit
Use Collection instead than List (a list is not indexed)
--
Alexandre Jaquet
----- Original Message -----
From: "William Salvucci" <Wi...@dn.netl.doe.gov>
To: <st...@jakarta.apache.org>
Sent: Wednesday, March 05, 2003 2:58 PM
Subject: Wrapping Collections in LazyList to auto-populate form onSubmit
>From the BananaBean example, I put the following in a nested:form
<nested:iterate property="bananas">
<nested:text property="flavour"/>
</nested:iterate>
and get this exception:
java.lang.IllegalArgumentException: Property 'bananas' is not indexed
In the form I construct the bananas list using
private List bananas = ListUtils.lazyList(new ArrayList(),
new Factory()
{
public Object create() {
return new BananaBean();
}
});
In the display action I populate the list using bananas.add
---------------------------------------------------------------------
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
Re: Wrapping Collections in LazyList to auto-populate form onSubmit
Posted by alexj <al...@freesurf.ch>.
Use Collection instead than List (a list is not indexed)
--
Alexandre Jaquet
----- Original Message -----
From: "William Salvucci" <Wi...@dn.netl.doe.gov>
To: <st...@jakarta.apache.org>
Sent: Wednesday, March 05, 2003 2:58 PM
Subject: Wrapping Collections in LazyList to auto-populate form onSubmit
>From the BananaBean example, I put the following in a nested:form
<nested:iterate property="bananas">
<nested:text property="flavour"/>
</nested:iterate>
and get this exception:
java.lang.IllegalArgumentException: Property 'bananas' is not indexed
In the form I construct the bananas list using
private List bananas = ListUtils.lazyList(new ArrayList(),
new Factory()
{
public Object create() {
return new BananaBean();
}
});
In the display action I populate the list using bananas.add
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org