如何模拟< nested:root>来自Struts 2中的Struts 1? [英] How to emulate <nested:root> from Struts 1 in Struts 2?

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

问题描述

我正在将Struts 1应用程序转换为Struts2.我有一个包含几个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> 类似,我在这个特定标签上几乎没有发现什么,所以我在主代码中添加了 include 语句JSP和我在子JSP中添加了< html:form> ,但是没有用.

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.

起初我只是在子JSP中添加了< s:form> ,子JSP中的代码被传递了,但是子JSP中存在的所有标记均未得到处理.

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.

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

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