从 link 调用另一个 JSP 时出现 404 错误

Getting 404 error calling another JSP from link

我的网页中有一个菜单,我添加了一个新的 link 不工作。我收到此错误消息。

HTTP Status 404 – Not Found

Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

这是 link 的 HTML 代码。

<td><a href="<c:url value="/35yearreunion" />"><img src="images/menu/35-year-reunion.jpg" alt="Memories" /></a></td>

我有一个 Spring 控制器方法,就是这个。我的网页名为 reunion2021.jsp.

@RequestMapping(value = "/35yearreunion")
public String thirtyfiveYearReunion(Model model) {
    return "reunion2021";
}

尝试将请求方法添加到您的控制器的方法中:

@RequestMapping(value = "/35yearreunion",method = RequestMethod.GET)
public String thirtyfiveYearReunion(Model model) {
    return "reunion2021";
}

或者这样:

@GetMapping(value = "/35yearreunion")
public String thirtyfiveYearReunion(Model model) {
    return "reunion2021";
}