【问题标题】:How to open one jsp from another through struts如何通过struts从另一个打开一个jsp
【发布时间】:2013-04-02 16:47:44
【问题描述】:

如何通过Struts打开一个jsp从另一个

例如,

我有 2 个 JSP,Page1.jsp 和 Page2.jsp。

Page1.jsp 不包含任何表单。

Page2.jsp 包含一个表单

我需要一个 Page1.jsp 上的链接,点击后会将我带到 Page2.jsp

哪些Actionmappings需要添加struts-config.xml


更新:

我尝试在 Page1.jsp 中添加这些行

<html:link page="Page2.do">Page2</html:link>

<a href="Page2.do">Page2</a>

struts-config.xml中,以下Action-mapping

<action path="/Page2"
parameter="Page2.jsp"
type="org.apache.struts.actions.ForwardAction"/>


"href" 有效,而带有 "html:link" 的则无效 将我带到 Page2.jsp

这是为什么呢?

【问题讨论】:

  • 使用 struts 版本 1.x
  • Struts1. JSP 页面的加载方式是否存在差异 - 在 struts 1 和 Struts2 之间?
  • 只体验过struts 1,struts 2看起来完全不同

标签: jsp struts


【解决方案1】:

使用 struts 版本 1.x(在 Page1.jsp 中):

<html:link action="/action"> 

然后在 struts-config.xml 中:

<action path="/action" forward="{path to }Page2.jsp"/>

【讨论】:

  • 不客气,太糟糕了,没有其他人愿意给出另一个答案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-09-28
  • 2021-06-23
  • 2015-05-30
  • 1970-01-01
  • 2013-03-09
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多