【问题标题】:404 happen when using redirect result type in Struts2 (to redirect from one jsp to another)在 Struts2 中使用重定向结果类型时发生 404(从一个 jsp 重定向到另一个)
【发布时间】:2018-01-21 03:08:22
【问题描述】:

我是 Struts2 的初学者,正在按照 tutorialspoint 提供的教程进行操作。目前我正在测试提供的代码:Struts 2 - Redirect Action

但是,当我单击“Say Hello”按钮时,出现 404 错误。

我想问两个问题:

  1. 学习 Struts2 的重定向结果类型的更好方法是什么?
  2. struts2的版本会不会导致404错误?
  3. tutorialspoint 提供的代码有什么遗漏吗?

由于代码只是教程点的副本,我不打算在这里提供。

【问题讨论】:

    标签: java jsp redirect struts2


    【解决方案1】:

    学习 Struts2 的重定向结果类型的更好方法是什么?

    Redirect Result

    struts2的版本会不会导致404错误?

    原因未定义,但如果 url 中确定的操作名称未映射,则框架返回 404。如果您需要了解返回 404 的原因,请参阅this

    tutorialspoint 提供的代码有什么遗漏吗?

    WebContent/WEB-INF/classes/struts.xml 是配置文件的错误位置。使用/src/struts.xml

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-15
      • 1970-01-01
      • 2013-09-05
      • 2016-07-16
      • 2010-11-14
      • 1970-01-01
      相关资源
      最近更新 更多