struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Submitting a variable amount of form data
Date Sun, 29 Jul 2007 13:13:51 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard,

Richard Sayre wrote:
> I have a form that can have 1 to many 'Name'  text fields.  In struts
> 2 how do I set up the action so it can automatically grab the values
> that are in those fields?
> 
> If I had 1 name field I would just put a name variable in the Action
> Class and create a setter and getter for it.  How do I do this with
> multiple names?

You do the same thing, but use an array of String objects as the data type:

private String[] _name;
public void setName(String[] name) { _name = name }
public String[] getName() { return _name; }

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGrJKP9CaO5/Lv0PARAvTnAJ4mWls7/Ms5RbKcBo1OIz0RXUWvkQCbBz69
Mfp7JuBYAwLCmLNNK+NTtR0=
=JmcI
-----END PGP SIGNATURE-----

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


Mime
View raw message