@RequestMapping(value = "") public String list( @RequestParam(value = "page", defaultValue = "1") int pageNumber, @RequestParam(value = "page.size", defaultValue = PAGE_SIZE) int pageSize, @RequestParam(value = "sortType", defaultValue = "auto") String sortType, Model model, ServletRequest request) { Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_"); Long userId = getCurrentUserId(); Page<Task> tasks = taskService.getUserTask(userId, searchParams, pageNumber, pageSize, sortType); model.addAttribute("tasks", tasks); model.addAttribute("sortType", sortType); model.addAttribute("sortTypes", sortTypes); // 将搜索条件编码成字符串,用于排序,分页的URL model.addAttribute( "searchParams", Servlets.encodeParameterStringWithPrefix(searchParams, "search_")); return "task/taskList"; }
@RequestMapping(method = RequestMethod.GET) public String list( @RequestParam(value = "page", defaultValue = "1") int pageNumber, @RequestParam(value = "page.size", defaultValue = PAGE_SIZE) int pageSize, @RequestParam(value = "sortType", defaultValue = "auto") String sortType, Model model, ServletRequest request) { Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_"); // Long userId = getCurrentUserId(); Page<KeyWords> keywordss = keywordsService.getUserKeyWords(searchParams, pageNumber, pageSize, sortType); model.addAttribute("keywords", keywordss); model.addAttribute("sortType", sortType); model.addAttribute("sortTypes", sortTypes); // 将搜索条件编码成字符串,用于排序,分页的URL model.addAttribute( "searchParams", Servlets.encodeParameterStringWithPrefix(searchParams, "search_")); return "bd/keywords/keywordsList"; }