问题描述
我正在将 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)