How to emulate lt;nested:rootgt; from Struts 1 in Struts 2?(如何模拟 lt;nested:rootgt;从 Struts 1 到 Struts 2?)
问题描述
我正在将 Struts 1 应用程序转换为 Struts 2.我有一个包含多个 JSP 的 jsp.这包括的 JSP 都有 <nested:root> 标签.
I am working on converting a Struts 1 app to Struts 2. I have a jsp that has several JSP included. This included JSPs all have the <nested:root>
tag on it.
除了类似于 <html:root>
之外,我在这个特定标签上几乎没有发现任何东西,所以我在我的 main 中添加了 include
语句JSP 和我将 <html:form>
添加到子 JSP 中,但它不起作用.
I have found little to nothing on this particular tag except that is similar to <html:root>
, so I've added the include
statement in my main JSP and I added the <html:form>
to the sub JSPs but it didn't work.
我最初只是将 <s:form>
添加到子 JSP 中,并且子 JSP 中的代码被传递,但子 JSP 中存在的任何标记都没有被处理.p>
I had initially just added <s:form>
to the sub JSPs and the code in the sub JSP was passed along but none of the tags existing in the sub JSP were processed.
推荐答案
所有 nested
标签和所有 Struts1 标签都应该被删除/替换为等效的 Struts2 标签.
All nested
tags and all Struts1 tags should be removed/replaced with equivalent Struts2 tags.
Struts2 中不需要嵌套标签,因为它由 OGNL 提供支持.使用 OGNL 表达式和 <s:include>
允许替换嵌套标签.
Nested tags not needed in Struts2 because it's powered with OGNL. Using OGNL expressions and <s:include>
allows to replace nested tags.
如果使用 s:include
渲染内容还不够,您可以使用 <s:action>
但它很重,并且在执行此标记时会重新创建 valueStack
,因此很少使用,但自定义包含 Fremarker 或 Velocity 模板的标签或自定义组件可以显着改变渲染时间并允许自定义.
If it's not enough to render content with s:include
you can use <s:action>
but it's heavy and it recreates a valueStack
when this tag executes, so it's rarely used, but custom tags or custom components that include Fremarker or Velocity templates can significantly change the rendering time and allows customization.
这篇关于如何模拟 <nested:root>从 Struts 1 到 Struts 2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何模拟 <nested:root>从 Struts 1 到 Struts 2?


基础教程推荐
- 多个组件的复杂布局 2022-01-01
- Java Swing计时器未清除 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 从 python 访问 JVM 2022-01-01