Jqgrid在Spring中实现

时间:2015-12-13 17:06:36

标签: java jquery spring jqgrid

我必须在桌面上显示数据,我为此选择了Jqgrid。但是我对响应URL上的 500内部服务器错误问题感到困惑。

以下是我的实施细节:

控制器: 方法1:

@RequestMapping(value="/allCase", method=RequestMethod.GET)
    public @ResponseBody void getAllSearchCases(HttpServletRequest request,
            HttpServletResponse response){
        LOG.info("Inside SearchCaseController#getAllSearchCases method.");
        try {
            response.getWriter().write(searchCaseServiceImpl.getAllSearchCaseAsJsonObject().toString());
        } catch (IOException e) {
            LOG.info("Error while writing data on response: Error inside class: {}, Caused by: {}", e.getClass(), e.getCause());
        }
    }

方法2:

@RequestMapping(value="/allCase", method=RequestMethod.GET)
    public @ResponseBody JSONObject getAllSearchCases(HttpServletRequest request,
            HttpServletResponse response){
        LOG.info("Inside SearchCaseController#getAllSearchCases method.");
        return searchCaseServiceImpl.getAllSearchCaseAsJsonObject();
    }

JavaScript代码:

$("#case-table").jqGrid({
        url : getAllCases,
        datatype : "json",
        width : jqgridwidth,
        loadui : 'disable',
        colNames : [ 'Case Id', 'Created By', 'Created Date', 'Search Key', 'Status', 'Action' ],
        colModel : [ {
            name : 'caseId',
            index : 'caseId',
            sorttype : "int",
            align : "left",
            width : 300,
        }, {
            name : 'Created By',
            index : 'createdBy',
            sorttype : "text",
            align : "left",
        }, {
            name : 'createdDate',
            index : 'createdDate',
            sorttype : "date",
            align : "left",
        }, {
            name : 'searchKey',
            index : 'searchKey',
            sorttype : "text",
            align : "left",
        }, {
            name : 'status',
            index : 'status',
            sorttype : "text",
            align : "left",
            classes : "pk-word-wrap",
        },{
            name : 'action',
            index : 'action',
            sorttype : "text",
            align : "left",
            classes : "pk-word-wrap",
        }, ],
        jsonReader : {
            root : "rows",
            page : "page",
            total : "total",
            records : "records",
            repeatitems : true,
            cell : "cell",
            id : "id",
        },
        cmTemplate : {
            resizable : false
        },
        loadComplete : function () {
        },
        rowNum : 100,
        beforeSelectRow : function ( id ) {

        },
        ignoreCase : true,
        height : "auto",
        pager : '#pagingDiv',
        sortname : 'caseId',
        viewrecords : true,
        loadonce : true,
        sortorder : "desc",
        recordpos : 'left',
        emptyrecords : "No Case Available",
        cellEdit : true,
    });

错误是: enter image description here

你们能帮助我弄清楚出了什么问题吗?

谢谢。

0 个答案:

没有答案