【问题标题】:Getting 404 error calling another JSP from link从链接调用另一个 JSP 时出现 404 错误
【发布时间】:2021-09-26 05:11:11
【问题描述】:

我的网页中有一个菜单,但我添加的新链接无效。我收到此错误消息。

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.

这是链接的 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";
}

【问题讨论】:

    标签: spring jsp http-status-code-404


    【解决方案1】:

    尝试将请求方法添加到控制器的方法中,无论是这样:

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

    或者这样:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-03
      • 2018-02-01
      • 1970-01-01
      • 2019-08-14
      • 1970-01-01
      • 2020-06-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多