当前位置: 代码迷 >> Java Web开发 >> ajax报系统异常
  详细解决方案

ajax报系统异常

热度:223   发布时间:2016-04-12 22:53:13.0
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());

    }


ajax代码

  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) {
  相关解决方案