Spring mvc 如何在spring mvc中执行分页? //这是我的控制器,它给了我一个列表。。。。。。。。。。。。 @请求映射(“/getList”) 公共模型和视图获取列表(模型模型){ List empList=empService.getEmpList(); 员工emp=新员工(); model.addAttribute(“员工”,emp); 返回新的ModelAndView(“empList”、“empList”、“empList”); }
我的问题是我在一页中有一个员工列表。如果我有100名员工,我需要在下一页中显示他们。因此,当我单击“上一页”按钮时,在下一页上按“上一页”按钮时显示的上一页列表半身像必须通过保持“下一页”和“上一页”按钮来显示。请给出如何执行该操作的解决方案。有什么办法吗给我解决方案使用Spring数据JPA并创建一个存储库。它支持分页(和排序!)@RequestMapping(“/getList”)公共模型和查看getList(@RequestParam(value=“page”,required=false)整数页,模型模型,@RequestParam(value=“page\u size”,required=false)整数页大小){page=0;page\u size=10;if(page==0){page=page+page\u size;}List empList empService.getEmpList1(page,page_size);Employee emp=new Employee();model.addAttribute(“Employee”,emp);return new ModelAndView(“empList”,“empList”,empList);}这是我的控制器,我需要执行此操作我不应该使用jpa。请告诉我怎么做?Spring mvc 如何在spring mvc中执行分页? //这是我的控制器,它给了我一个列表。。。。。。。。。。。。 @请求映射(“/getList”) 公共模型和视图获取列表(模型模型){ List empList=empService.getEmpList(); 员工emp=新员工(); model.addAttribute(“员工”,emp); 返回新的ModelAndView(“empList”、“empList”、“empList”); },spring-mvc,Spring Mvc,我的问题是我在一页中有一个员工列表。如果我有100名员工,我需要在下一页中显示他们。因此,当我单击“上一页”按钮时,在下一页上按“上一页”按钮时显示的上一页列表半身像必须通过保持“下一页”和“上一页”按钮来显示。请给出如何执行该操作的解决方案。有什么办法吗给我解决方案使用Spring数据JPA并创建一个存储库。它支持分页(和排序!)@RequestMapping(“/getList”)公共模型和查看getList(@RequestParam(value=“page”,required=false
//this is my controller which gives me a list............
@RequestMapping("/getList")
public ModelAndView getList(Model model){
List<Employee> empList = empService.getEmpList();
Employee emp=new Employee();
model.addAttribute("employee", emp);
return new ModelAndView("empList", "empList", empList);
}