Typical checkbox tag usage is like:
<l:inputCheckbox name="mortgage.starred"/>
Standard HTML dictates that the browser do not send values for unchecked checkboxes, but this would make it impossible to set a boolean value to false. To circumvent this, the generated HTML for the above code will look like this:
<input type="checkbox" name="mortgage.starred"/> <input type="hidden" value="false" name="mortgage.starred"/>
If the checkbox is not checked the underlying hidden value of "false" will be submitted anyway. This should be taken into consideration if you plan to do funny things with checkboxes and javascript.
A checkbox can also be bound to Set properties. In this case, the checkbox "value" attribute will be added to the Set when checked:
public class MortgagesAction extends AbstractAction {
/** list of selected items */
private Set selectedItems;
<ul>
<c:forEach var="item" items="${action.items}" >
<li><l:inputCheckbox name="selectedItems" value="${item.id}"/> Select item ${item.name}</li>
</c:forEach>
</ul>
This will add the value of the "id" property of each checked item.