2014-07-09 75 views
0

我有一個jqgrid來填充來自後端的數據。直到控制器我有數據,但它沒有得到呈現在grid.Enabling火蟲說NetworkError:406不可接受。 我有jackson-core-asl-1.x.jarjackson-mapper-asl-1.x.jar在我的classpath和調度程序aservlet中。 我也嘗試改變頭解決方案作爲標題=「Accept = application/json」。我正在使用SPring4。以下是我在控制器中的代碼。NetworkError:406不可接受的jqgrid

`

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

回答

0

我覺得這裏:

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

在這裏,而不是headers應使用produces是這樣的:

@RequestMapping(value = "/populateAddedDeviceGrid.html", produces={"application/json"} , method = RequestMethod.POST) 
+0

它並沒有解決我的問題,我想使用** @ RequestMapping(value =「/populateAddedDeviceGrid.html」,產生=「application/json」,method = R equestMethod.POST)**。但仍然給我406 HTTP錯誤 – neel