如何在Struts 2中模拟Struts 1中的嵌套:root? [英] How to emulate nested:root from Struts 1 in Struts 2?

查看:133
本文介绍了如何在Struts 2中模拟Struts 1中的嵌套:root?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将Struts1应用程序转换为Struts2。我有一个包含几个JSP的jsp。这包括JSP都有嵌套:root 标签。

I am working on converting a Struts1 app to Struts2. I have a jsp that has several JSP included. This included JSPs all have the nested:root tag on it.

我发现这个特定标签几乎没有什么,除了类似于 html:root ,所以我'我在我的主JSP中添加了 include 语句,并将 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中存在的任何标记。

I had initially just addeds: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.

推荐答案

应删除/替换所有嵌套标签和所有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 你可以使用:动作但它很重,当这个标签执行时它会重新创建一个 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.

这篇关于如何在Struts 2中模拟Struts 1中的嵌套:root?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆