0

バックエンドからのデータを入力するためのjqgridがあります。コントローラーまでデータはありますが、グリッドでレンダリングされません。火のバグを有効にすると、NetworkError: 406 Not Acceptableと表示されます。クラスパスとディスパッチャ aservletにjackson-core-asl-1.x.jarjackson-mapper-asl-1.x.jarがあります。また、解決策の 1 つに従って headers="Accept=application/json" としてヘッダーを変更しようとしました。SPring4 を使用しています。以下は、コントローラーの私のコードです。

`

@RequestMapping(value = "/populateAddedDeviceGrid.html", headers="Accept=application/json", method = RequestMethod.POST)
    public @ResponseBody
    GridPojo populateAddedDeviceGrid(HttpServletRequest request, GridPojo gridPojo) {
        System.out.println("Enetering DeviceMasterController-->populateAddedDeviceGrid (POST)");

        List<DeviceMaster> deviceMasterList = new ArrayList<DeviceMaster>();

        try {
            deviceMasterList = deviceMasterService.getAllDeviceMaster();


            gridPojo.setGridData(deviceMasterList.toArray());
            gridPojo.setRows(deviceMasterList.size());
            gridPojo.setRecords(deviceMasterList.size());

        } catch (Exception e) {
            e.printStackTrace();
        }
        return gridPojo;
    }` 
4

1 に答える 1

0

私はここで考えます:

@RequestMapping(value = "/populateAddedDeviceGrid.html", headers="Accept=application/json", method = RequestMethod.POST)
//-------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

here の代わりに、次のようheadersに使用する必要があります。produces

@RequestMapping(value = "/populateAddedDeviceGrid.html", produces={"application/json"} , method = RequestMethod.POST)
于 2014-07-09T11:53:30.380 に答える