I have a html form with action attribute pointing to struts action
Here is a JSP
<s:select name="roleId" id="roleId" list="roleMap" headerKey=""
headerValue="SELECT" theme="simple" value="%{roleId}" cssClass="dropdown_menu"></s:select>
It generates html like
<select name="roleId" id="roleId" class="dropdown_menu">
<option value=""
>SELECT</option>
<option value="11">User</option>
<option value="9">Administrator</option>
</select>
I have an action with getters and setters
//
//
//
private String roleId;
//
//
public String getRoleId() {
return roleId;
}
public void setRoleRId(String roleId) {
this.roleId = roleId;
}
//
//
//
And the validation:
<field name="roleId">
<field-validator type="requiredstring">
<message key="USER.ROLE_ERR" />
</field-validator>
</field>
But for some reason roleId property is not setting and it always gives me error saying role must be specified. When I disable the validation action receives all properties except roleId
, What can be the proble , How do I detect such kind of errors?,
I am using Struts 2.0, Windows 7 , eclipse Ganimid and Tomcat 6.0