How to emulate nested:root from Struts 1 in Struts 2?

…衆ロ難τιáo~ 提交于 2019-11-28 11:26:34

问题


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.

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.

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.


回答1:


All nested tags and all Struts1 tags should be removed/replaced with equivalent Struts2 tags.

Nested tags not needed in Struts2 because it's powered with OGNL. Using OGNL expressions and s:include allows to replace nested tags.

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.



来源:https://stackoverflow.com/questions/37883587/how-to-emulate-nestedroot-from-struts-1-in-struts-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!