@PathVariable

/**
* @PathVariable 可以来映射 URL 中的占位符到目标方法的参数中.
* @param id
* @return
*/

 

jsp页面请求

<a href="springmvc/testPathVariable/1">Test PathVariable</a>

Action中方法

@RequestMapping("/testPathVariable/{id}")
public String testPathVariable(@PathVariable("id") Integer id) {
System.out.println("testPathVariable: " + id);
return SUCCESS;
}

相关文章:

  • 2021-07-15
  • 2021-10-12
  • 2021-05-13
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
猜你喜欢
  • 2021-09-05
  • 2022-12-23
  • 2022-02-01
  • 2021-06-28
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案