struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin J. Turner" <ktur...@dceg.com>
Subject RE: Multiple checkboxes with the same name -- possible with Struts?
Date Thu, 28 Feb 2002 19:15:47 GMT
I will try again.. there must be something I'm not doing right

Thx.

-----Original Message-----
From: Jonathan James [mailto:jjames@focus-technologies.com] 
Sent: Thursday, February 28, 2002 2:16 PM
To: Struts Users Mailing List; kturner@dceg.com
Subject: Re: Multiple checkboxes with the same name -- possible with
Struts?


>  I'm assuming its not smart enough to do
> this?

Nope. Struts is smart enough to do this. If you use the multibox tag as
David Gaulin
suggested and your bean looks like

public void setFruit( String[] fruits ) {...}
public String[] getFruit() {...}

Then all your multiboxes look like

<html:multibox property="fruit" value="kiwi" />
and so on.

Your bean will be automatically populated with an array of all the
selected
fruits. So in your example

> [x] Apple
> [ ] Kiwi
> [x] Mango
> [ ] Banana

getFruit() in your action would return an array containg the strings
"Apple"
& "Mango"

Are you trying this and it's not working?

-Jonathan


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



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


Mime
View raw message