I have the following code to do a doubleselect using Struts2 and the jquery plugin:
jsp:
<s:url id="ajaxActionUrl" value="/getStateCodesJson"/>
<sj:select name="stateCodeId"
id="stateCodeId"
label="State"
href="%{ajaxActionUrl}"
onChangeTopics="reloadSecondSelect"
list="stateCodeList"
listKey="id"
listValue="label"
emptyOption="true"
headerKey="-1"
headerValue="Please Select A State"/>
<sj:select name="subCodeId"
id="subCodeId"
label="Sub Feature"
href="%{ajaxActionUrl}"
formIds="mapGeneratorForm"
reloadTopics="reloadSecondSelect"
list="subCodeList"
listKey="id"
listValue="subCodeDescription"
emptyOption="true"
headerKey="-1"
headerValue="Please Select A Code"/>
Action:
@Action(value = "getStateCodesJson", results = {
@Result(name = "success", type = "json")
})
public String getStateCodesJson() throws Exception {
stateCodeList = stateCodeService.getAll();
Collections.sort(stateCodeList);
if (stateCodeId != null) {
StateCode stateCode = stateCodeService.getById(stateCodeId);
subCodeList = subCodeService.getByStateCode(stateCode);
}
return SUCCESS;
}
When the jsp first loads, the getStateCodesJson() method is called 3 times. However, after making the change, the action is not called again, so the second never gets populated.
Can anyone assist?
Jason