thtmeleaf传参
方法一
th:href="@{/editEmp?id=}+${emp.getId()}"
链接形式 http://localhost:8081/editEmp?id=0
接收方法
@GetMapping("/editEmp")
public String editEm(@RequestParam("id")Integer id, Model model){
方法二
th:href="@{/editEmp(id=${t.id})}"
//多个参数
th:href=@{/editEmp(id=${id},name=${name})}
链接形式 http://localhost:8081/editEmp/0
或 http://localhost:8081/editEmp/0/gugugu
接收方法
@GetMapping("/editEmp/{id}")
public String editEm(@PathVariable("id")Integer id, Model model){
//多个参数
@GetMapping("/editEmp/{id}/{name}")
public String editEm(@PathVariable("id")Integer id, @PathVariable("name")String name, Model model){