You should write some kind of template in @RequestMapping :
http://localhost:8080/userGrid?_search=${search}&nd=${nd}&rows=${rows}&page=${page}&sidx=${sidx}&sord=${sord}
Now define your business method as follows:
@RequestMapping("/userGrid?_search=${search}&nd=${nd}&rows=${rows}&page=${page}&sidx=${sidx}&sord=${sord}") public @ResponseBody GridModel getUsersForGrid( @RequestParam(value = "search") String search, @RequestParam(value = "nd") int nd, @RequestParam(value = "rows") int rows, @RequestParam(value = "page") int page, @RequestParam(value = "sidx") int sidx, @RequestParam(value = "sort") Sort sort) { ............... }
So, the structure will display ${foo} according to @RequestParam .
Since sorting can be either asc or desc, I would define it as an enumeration:
public enum Sort { asc, desc }
Spring works great with enumerations.
AlexR Nov 03 '12 at 20:23 2012-11-03 20:23
source share