我正在使用spring-mvc-router将所有网址放在一个集中位置。如何在JSP文件中对控制器进行反向映射?
答案 0 :(得分:0)
在项目的自述页面中,integrating with JSP部分对此进行了详细描述:
在JSP中,声明taglib:
<%@ taglib prefix="route" uri="/springmvc-router" %>
然后使用反向方法生成URL:
<a href="<route:reverse action="userController.listAll" />">List all users</a>
也可以使用动态参数:
<a href="<route:reverse action="userController.showUser"
userId="42" />">Show user 42</a>