目录
一、参数名相同
test控制器
@RequestMapping("/test")
public String test(Model model){
model.addAttribute("id","19999");
model.addAttribute("name","zhangsan");
return "index";
}
index页面
<div><a th:href="@{t5(id=${id},name=${name})}">连接</a></div>
t5控制器
@RequestMapping("/t5")
public String t5(String id, String name){
System.out.println("id="+id+" name="+name);
return "index2";
}
二、参数名不同,使用@RequestParam注解
test控制器
@RequestMapping("/test")
public String test(Model model){
model.addAttribute("id","19999");
model.addAttribute("name","zhangsan");
return "index";
}
index页面
<div><a th:href="@{t5(id=${id},name=${name})}">连接</a></div>
t5控制器
@RequestMapping("/t5")
public String t5(@RequestParam("id") String uid, String name){
System.out.println("id="+uid+" name="+name);
return "index2";
}