【问题标题】:How to include one struts jsp in another when both jsps have <html:form>?当两个 jsp 都具有 <html:form> 时,如何在另一个中包含一个 struts jsp?
【发布时间】:2015-05-30 21:19:44
【问题描述】:

我有 2 个 jsp - jsp1 和 jsp2。 每个jsp都有一个定义。

jsp1

<html:form action="/action1" >
<html:hidden property="prop1" name="form1"/>
......
</html:form> 

jsp2

<html:form action="/action2" >
<html:hidden property="prop1" name="form1"/>
......
</html:form>

这是数据流

tab1 - jsp1 - form1 - action1
tab2 - jsp2 - form2 - action2

有什么方法可以在 tab1 中包含 jsp2 吗?它应该是这样的:

tab1 - jsp1+jsp2 
tab2 - jsp2

我正在寻找一种可以重用jsp、表单和操作的方法,因为现在两个选项卡都需要jsp2。 尝试了几种方法,例如&lt;html:include&gt;, &lt;tiles:insert&gt;, changes to struts-config.xml, tiles-def.xml etc. 似乎没有任何效果。有人有什么想法吗?

【问题讨论】:

  • 试试这个 或 跨度>

标签: jsp struts action struts-config actionform


【解决方案1】:

试试这个

<%@ include file="jsp2.jsp"%> 

在 jsp1.jsp 页面中,它可以按您的意愿工作。这里 jsp2.jsp 是可复用的

【讨论】:

  • @user811433,你检查了吗?
猜你喜欢
  • 1970-01-01
  • 2019-08-20
  • 1970-01-01
  • 2013-04-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多