我有一个名为 reports.jsp 的 jsp 页面,我在 View 中显示了链接供用户单击。 如何通过单击将传递参数的链接来调用 Spring Controller 方法。
最佳答案
您必须使用 @PathVariable
才能执行此操作。示例:
Jsp:
<a href="<c:url value="/test/${object.argument}" />" >hello</a>
Controller :
@RequestMapping(value = "/test/{argument}", method = RequestMethod.GET)
public String Controller(@PathVariable("argument") String argument) {
...
}
关于java - 如何在 Spring-mvc 中使用 html 链接调用 Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24403672/