这是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);
}
本文详细解析了JS中获取飞机型号列表的代码实现,并通过Action方法在后台进行数据查询和处理,最终生成可供选择的飞机型号下拉列表。
1222

被折叠的 条评论
为什么被折叠?



