You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hamster <st...@site-systems.de> on 2005/02/13 20:58:50 UTC

formbean with List field

 
I'm wondering if I can have a formbean containing a List of Strings. Is
that recognized by Struts correctly?
 
I need that for a shopping cart implementation, where the user can
modify the amount of the articles in the shopping cart. For each article
should be a text field for entering a number. So I think I need here a
List of Strings in the form bean, right?
 
How does the implementaion look like in the form bean?

Re: formbean with List field

Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Hamster" <st...@site-systems.de>

> I'm wondering if I can have a formbean containing a List of Strings. Is
> that recognized by Struts correctly?

I have had more luck with String[] than ArrayList.

> I need that for a shopping cart implementation, where the user can
> modify the amount of the articles in the shopping cart. For each article
> should be a text field for entering a number. So I think I need here a
> List of Strings in the form bean, right?
>
> How does the implementaion look like in the form bean?

This sounds like a set of indexed properties-- you'd need to keep the
quantity 'lined up' with the item number, and you can't depend on the order
of the parameters in the request.  (In practice, they arrive in the order
shown on the HTML form, but that's not guaranteed.)  If not indexed
properties, then nested beans in the form.

-- 
Wendy Smoak



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


AW: formbean with List field

Posted by Hamster <st...@site-systems.de>.
Hello struts users!

I still have this issue... can anyone help me with this?

--
 
I'm wondering if I can have a formbean containing a List of Strings. Is
that recognized by Struts correctly?
 
I need that for a shopping cart implementation, where the user can
modify the amount of the articles in the shopping cart. For each article
should be a text field for entering a number. So I think I need here a
List of Strings in the form bean, right?
 
How does the implementaion look like in the form bean?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org