原因:就是spring的controller上的@RequestMapping的实参和方法里面的形参名字不一致
前端:
<a class="btn btn-app" th:href="@{/console/milestone/allsee(id=${projectId})}">
<i class="fa fa-eye"></i> 查看
</a>
错误写法1:
@RequestMapping(value="/allsee/{id}", method = {RequestMethod.GET})
public String SeeMilestone(HttpServletRequest request,@PathVariable String id) {
return "milestone/see";
}
错误写法2:
@RequestMapping(value="/allsee/{id}", method = {RequestMethod.GET})
public String SeeMilestone(HttpServletRequest request) {
String id = request.getParameter("id");
return "milestone/see";
}
正确写法:
@RequestMapping(value="/allsee", method = {RequestMethod.GET})
public String SeeMilestoneIndex(Model model,HttpServletRequest request) {
String id = request.getParameter("id");
}