Spring MVC 的 @PathVariable注解详解

JSP中的一个a标签:

<a href="hello2/1">PathVariable</a>

后台方法接收:

@RequestMapping("hello2/{id}")
public String hello2(@PathVariable("id") Integer id){
	System.out.println(id);
	System.out.println("hello world");
	return "success";
}
@PathVariable:就是获取url中传入的id的值,就是1。

猜你喜欢

转载自blog.csdn.net/java_xuetu/article/details/80041851