ajax报系统错误
java代码
@RequestMapping("/get_largeFacility.do")
public void getLargeFacility(HttpServletRequest req,
HttpServletResponse res, HttpSession session) throws IOException {
Integer id = !Check.isNullStr(req.getParameter("id")) ? Integer
.valueOf(req.getParameter("id")) : 0;
Map<String, Object> modelMap = new HashMap<String, Object>();
if (id > 0) {
String queryString = "SELECT facility FROM TjkwShqshFacilityFee as facility WHERE facility.feeId = "
+ id;
List<TjkwShqshFacilityFee> facility = (List<TjkwShqshFacilityFee>) this.dao
.search(queryString);
modelMap.put("errorCode", 0);
modelMap.put("facility", facility);
} else {
modelMap.put("errorCode", 1);
modelMap.put("errorMessage", CommonMessage.NO_RECORD);
}
JSONObject jsonObject = JSONObject.fromObject(modelMap);
res.getWriter().print(jsonObject.toString());
}
function showEditEquipmentDialog(id) {
//根据id获取大型设备的信息
$
.ajax({
url : "../jcjh/get_largeFacility.do?id=" + id,
type : 'get',
dataType : "json",
success : function(data, status, xhr) {
if (data.errorCode == 0) {
$("#fee_id").val( data.facility.feeId);
$("#fac_name_id").val(data.facility.nameSize);
$("#unit_id").val( data.facility.unit);
$("#buy_num_id").val( data.facility.facilityAmount);
$("#price_id").val(data.facility.unitPrice);
$("#allocate_funds_id").val(data.facility.allocateFunds);
$("#reasons_id").val(data.facility.reasons);
$("#equipment_dialog").dialog("open");
} else {
popDialog("messageDialog",
data.errorMessage);
}
},
error : function(response) {
popDialog("messageDialog", "系统错误!");
}
});
}