Has anyone had luck using radio buttons?

Ted Husted

The idea behind a radio button is that you have a String field that has one of a fixed set of values, and you want to render one radio button for each of them.

Let's assume that your bean property "gender" can have property values "Male" or "Female". You might display them like this:

<html:radio property="gender" value="Male">
<bean:message key="gender.male"/>

<html:radio property="gender" value="Female">
<bean:message key="gender.female"/>

A particular radio button will be selected if the value returned for this property matches the "value" attribute of that button's <html:radio> element.

In the example above, we're also looking up the actual text of the strings displayed on the HTML page in a message resources bundle, so that it is suitably internationalized.

[Craig McClanahan]