0
我有下面的代碼中使用的Struts2與jQuery插件做doubleselect:Stryts-jQuery插件發行雙選擇
的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(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;
}
當jsp第一次加載時,getStateCodesJson()方法被稱爲次。但是,進行更改後,操作不會再被調用,因此第二次操作不會被填充。
任何人都可以協助嗎?
傑森
不是所有的粉絲:雙選,但我不接受一個好的答案是相當粗魯的。 :) – Jason 2011-02-06 12:38:18