0

I have a jqgrid to populate data which is coming from backend. Till controller i have data but its not getting rendered in grid.Enabling Fire bug says NetworkError: 406 Not Acceptable. I have jackson-core-asl-1.x.jar and jackson-mapper-asl-1.x.jar in my classpath and in dispatcher aservlet. I have also tried to change header according to one of solution as headers="Accept=application/json".I am using SPring4. Following is my code in controller.

`

@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;
    }` 
neel
  • 1

1 Answers1

0

I think here:

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

here instead of headers should be used produces something like this:

@RequestMapping(value = "/populateAddedDeviceGrid.html", produces={"application/json"} , method = RequestMethod.POST)
Jai
  • 74,255
  • 12
  • 74
  • 103
  • It did not solved my problem , i tried using **@RequestMapping(value = "/populateAddedDeviceGrid.html", produces="application/json" , method = RequestMethod.POST)** . but still gives me 406 http error – neel Jul 24 '14 at 03:59