Not sure if your optionOne and optionTwo is two groups of radio button or two radio button in one group. I give you an example to illustrate how to set default values:
Suppose I have a group (group1) of radio buttons, say 3. I want to preselect the first one.
In my JSP file. I do this:
In the form bean file, I will have a property called "group1", and default value is "rb1"
private String group1="rb1";
Hope this helps.
Ciaran Hanley wrote:
I have a form consisting of several radio buttons. Upon form generation I
need radio buttons in the form to be checked based on the attribute of a
bean stored in the session. If the beans property is true then a particular
radio button value of "true" should be checked.
I want these preselected based on a bean which has variables corresponding
to each radio button
boolean optionOne = false;
boolean optionTwo = true;
How can I achieve this?
Do you Yahoo!?
Meet the all-new My Yahoo! – Try it today!