赞
踩
/**
* 4、通过@PathVariable获取路径中的参数
* @param username
* @param password
* @return
*/
@RequestMapping(value="/addUser/{username}/{password}",method=RequestMethod.GET)
public String addUser(@PathVariable String username,@PathVariable String password) {
return "index";
}
例如:访问http://localhost:8888/yuanlegeyuan/1234 路径时,则自动将URL中变量的模板{username}和{password}绑定到通过@PathVariable注解的同名方法上,即入参为username=yuanlegeyuan,password=1234
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。