Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

java - How to emulate <nested:root> from Struts 1 in Struts 2?

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.

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 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...