You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Struts Newsgroup (@Basebeans.com)" <st...@basebeans.com> on 2002/07/09 20:40:02 UTC

dynamically collect a series of String values to a vector property in an ActionForm

Subject: dynamically collect a series of String values to a vector property in an ActionForm
From: "tom" <ho...@hongkong.com>
 ===
How can I initialize a vector of Strings and assign values to the Strings in
jsp (view component) so that an ActionForm can collect the vector property
(a collection of String values) dynamically which depends on the number
values to be grasped from the submission form?



Thank you very much



Tom

home@hongkong.com





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: dynamically collect a series of String values to a vector property in an ActionForm

Posted by Joe Germuska <Jo...@Germuska.com>.
In your ActionForm, represent the property as a String[], not a 
Vector.  The automated processing in Struts will add one value to 
that String Array for each HTML input element with that property name.

You can initialize it however you like in an Action that forwards to 
the input JSP, and you can change the String[] to a Vector (or an 
ArrayList if you don't need synchronization, which you probably 
don't) in the Action to which the form submits.

There may be more to your question which I didn't understand, about 
the number of values, but if all the properties (input fields) have 
the same name, then it doesn't matter how many of them there are.

Joe


At 11:40 AM -0700 2002/07/09, Struts Newsgroup (@Basebeans.com) wrote:
>Subject: dynamically collect a series of String values to a vector 
>property in an ActionForm
>From: "tom" <ho...@hongkong.com>
>  ===
>How can I initialize a vector of Strings and assign values to the Strings in
>jsp (view component) so that an ActionForm can collect the vector property
>(a collection of String values) dynamically which depends on the number
>values to be grasped from the submission form?
>
>
>
>Thank you very much
>
>
>
>Tom
>
>home@hongkong.com
>
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


-- 
--
* Joe Germuska    { joe@germuska.com }
"It's pitiful, sometimes, if they've got it bad. Their eyes get 
glazed, they go white, their hands tremble.... As I watch them I 
often feel that a dope peddler is a gentleman compared with the man 
who sells records."
	--Sam Goody, 1956
tune in posse radio: <http://www.live365.com/stations/289268>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>