The moose likes Struts and the fly likes difference between html:checkbox and html:multibox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "difference between html:checkbox and html:multibox" Watch "difference between html:checkbox and html:multibox" New topic

difference between html:checkbox and html:multibox

sai prasanna
Ranch Hand

Joined: May 02, 2005
Posts: 167
hi all

what is the difference between <html:checkbox> and <html:multibox>.
the first one for single checkbox and the other for group of checkboxes is this correct
please explain

thanks in advance
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You use <html:checkbox> when you have a single value on your ActionForm that can be either true or false:

Check here if you like JavaRanch <html:checkbox property="likesJavaRanch" value="true" />

You use <html:multibox> when the underlying property in your ActionForm is an array of strings. You then have more than one checkbox to populate that array:

What fruits do you like? apples <html:multibox property="fruits" value="apples"/> oranges <html:multibox property="fruits" value="oranges"/> bananas <html:multibox property="fruits" value="bananas"/>

If all boxes are checked when this form is submitted, the likesJavaRanch property (type boolean) will be true, and the fruits property (type String[]) will contain "apples, "oranges", "bananas"

Consultant, Sima Solutions
I agree. Here's the link:
subject: difference between html:checkbox and html:multibox
It's not a secret anymore!