0
Select initial value in struts
Suppose, you want a default value to be selected during the page load while using DynaValidatorForm or DynaValidatorActionForm, use initial attribute of field-property to define the value that is to be selected by default.
eg; you have a SEX porperty whose value can be either male or female and you use radio button. If you wish male to be selected by default, then put inial=male.
Here is my form-bean definition
Then, while rendering the form, male is initially selected for SEX property.
eg; you have a SEX porperty whose value can be either male or female and you use radio button. If you wish male to be selected by default, then put inial=male.
Here is my form-bean definition
<form-bean name="consumerRegistrationForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="firstname" type="java.lang.String" />
...
...
<form-property name="sex" type="java.lang.String"
initial="male" />
...
...
<form-property
name="userType" type="java.lang.String" initial="homeUser"/>
</form-bean>
Then, while rendering the form, male is initially selected for SEX property.