@RequestMapping(method=RequestMethod.GET) public ModelAndView allUsers(@RequestParam int page){ ModelAndView mav = new ModelAndView(); mav.setViewName("list"); List<String> list = new ArrayList<String>(); list.add("zhangsan"); list.add("lisi"); list.add(page+""); mav.addObject("list", list); return mav; }
如果,使页面默认为第一页,可以设置RequestParam的参数的值。
public ModelAndView allUsers(@RequestParam(defaultValue="1",required=false) int page){
时间: 2025-01-04 08:05:22