【问题标题】:use struts2.3.34 to redirect can't find the jsp使用struts2.3.34重定向找不到jsp
【发布时间】:2018-07-27 15:30:11
【问题描述】:

我用的是struts2.3.34版本,想重定向到WEB-INF下的hello.jsp和hello.jsp,显示404,为什么不能访问hello.jsp 我也尝试这样写<result name="testRedirect" type="redirect">/WEB-INF/hello.jsp</result>,也是 404。 谁能帮帮我?请。

【问题讨论】:

  • 您检查过您的war/ear 是否包含jsp 文件吗?
  • @yılmaz 是的,在WEB-INF下,我用type=redirectAction可以访问,但是我用type=redirect直接访问hello.jsp是404
  • 当 JSP 页面在 WEB-INF 中时,您不能直接进入该页面。您的 URL 栏表明您不会执行操作,而是 JSP。这不是它的工作原理。
  • @DaveNewton 是的,你是对的,我把 hello.jsp 移出 WEB-INF,我可以访问它。但是我仍然有问题,我知道不能直接访问WEB-INF中的jsp,也就是说重定向到jsp就像直接访问jsp一样?
  • 我不明白这个问题。您根本不应该直接访问 JSP 页面。事实上,如果页面上有 S2 标记,它们无论如何都会中断。

标签: java jsp struts2


【解决方案1】:

查看struts官方页面。

<result name="success" type="redirect">
  <param name="location">foo.jsp</param>
  <param name="parse">false</param>
</result>

http://struts.apache.org/core-developers/redirect-result.html

【讨论】:

  • 我刚绑了,也没用,错误也是404,找不到hello.jsp
猜你喜欢
  • 2018-04-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多