Hi, all,
I am trying to find a way using struts to have a default selected value in an html select (drop down menu). I have found that with html:select, the name attribute should be pointed to a form bean in order to have that option selected.
However, after some research, I still do not understand how to make this work. I have form properties for the select menu, but not for the individual options? I am still not sure how to select a particular option. Perhaps mine is a special case because I amusing DynaValidatorActionForm, and thus the form bean is dynamic? Help please!
Here are snippets of my code:
form.jsp<html:select property="securityLevelId">
<html:option value="2">General User</html:option>
<html:option value="3">Power User</html:option>
<html:option value="4">Testing User</html:option>
<html:option value="5">Admin User</html:option>
<html:option value="6">Super User</html:option>
</html:select>
struts-config.xml<form-bean name="userForm" type="org.apache.struts.validator.DynaValidatorActionForm">
...
<form-property name="securityLevelId" type="java.lang.String" />
...
</form-bean>
Thanks!!