这是js中的代码
function getp PlaneNumList() {
var planeTypeId = document
.getElementById("qualityValuation.fkPlaneTypeId.id").value;
$.ajax({
type : 'post',//可选get
url : 'qualityvaluation/fm_getPlaneNumListByplaneTypeId.do?planeTypeId='
+ planeTypeId,
dataType : 'html',//服务器返回的数据类型 可选XML ,Json jsonp script html text等
success : function(data) {
document.getElementById("planeNum").innerHTML = data;
//"planeNum" 是<span id="planeNum"></span>
}
});
}
这是 Action 中的代码
public void getPlaneNumListByplaneTypeId() throws Exception {
//机号的集合
HqlBuilder hqlPlaneNumber = new HqlBuilder("select sdd from SysDataDictionary sdd where 1=1");
hqlPlaneNumber.append(" and sdd.parentDD.id=:planeTypeId").setParam("planeTypeId", planeTypeId);
planeNumberList = dataDictionaryService.findList(hqlPlaneNumber);
String planeNumHtml = "<select name=\"qualityValuation.fkPlaneNumberId.id\"><option>---请选择---</option>";
for (SysDataDictionary sdd : planeNumberList) {
planeNumHtml += "<option value=\""+sdd.getId()+"\">"+sdd.getDdName()+"</option>";
}
planeNumHtml += "</select>";
Renders.renderHtml(planeNumHtml);
}