2016-03-06 92 views
0

我正在向spring控制器發出請求,但我在itemfilter bean中獲得空白。彈簧數據未填充模型

http://localhost:8080:/project/api/paytype?cacheBuster=1457063200591&itemfilter=%7B%22name%22:%22Test%22,%22sortlist%22:%5B%7B%22fieldName%22:%22name%22,%22order%22:%22desc%22%7D%5D,%22filterlist%22:%5B%7B%22fieldName%22:%22name%22,%22operator%22:%22a%22,%22value%22:%221%22%7D%5D%7D&page=0&size=20 

春控制器的方法: -

@RequestMapping(value = "/paytypes", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) 
    @Timed 
    public ResponseEntity<List<Payintype>> getAllPaytypes(Pageable pageable, ItemFilter itemfilter) throws URISyntaxException {} 

分頁正確填充,但我得到itemfilter對象爲空。有人可以幫助解決這個問題嗎?

+0

@ AnchitPancholi你可以發佈ItemFilter類嗎? –

回答

0

您所使用的API網址是:

http://localhost:8080:/project/api/paytype&cacheBuster=1457063200591&itemfilter=%7B%22name%22:%22Test%22,%22sortlist%22:%5B%7B%22fieldName%22:%22name%22,%22order%22:%22desc%22%7D%5D,%22filterlist%22:%5B%7B%22fieldName%22:%22name%22,%22operator%22:%22a%22,%22value%22:%221%22%7D%5D%7D&page=0&size=20 

這應該是:

http://localhost:8080:/project/api/paytype?cacheBuster=1457063200591&itemfilter=%7B%22name%22:%22Test%22,%22sortlist%22:%5B%7B%22fieldName%22:%22name%22,%22order%22:%22desc%22%7D%5D,%22filterlist%22:%5B%7B%22fieldName%22:%22name%22,%22operator%22:%22a%22,%22value%22:%221%22%7D%5D%7D&page=0&size=20 

您需要使用問號,而不是符號(&)作爲URL之間的分隔符(?)和參數

+0

對不起,這是錯字錯誤,但仍然沒有得到的數據。我嘗試過?以及。 –