Struts 2
  1. Struts 2
  2. WW-1744

Support Sitemesh's applyDecorator tag using Freemarker Transform

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:
      None
    • Flags:
      Patch

      Description

        Issue Links

          Activity

          Hide
          Ted Husted added a comment -

          Ummm, did you forget to annex the patch Toby?

          If you still have it, just go ahead and apply it.

          -Ted.

          Show
          Ted Husted added a comment - Ummm, did you forget to annex the patch Toby? If you still have it, just go ahead and apply it. -Ted.
          Hide
          tm_jee added a comment -

          I think someone with more insight of struts2 should take a look at this first cause

          • there's a sitemesh plugin, should it belong there?
          • the changes affect FreemarkerManager which is part of the core (I think). It sounds strange if part of this is in the plugin and part of it is in the core
          • it uses webwork.properties, (which should be struts.properties equivalent but if not mistaken its being deprecated in favour of another configuration file) to decide if the sitemesh transform should be populated into freemarker's model.

          Maybe we should leave this with WebWork and not port it to struts2.

          The changes are :-
          Modified: trunk\src\java\com\opensymphony\webwork\WebWorkConstants.java
          Modified: trunk\src\java\com\opensymphony\webwork\components\Component.java
          Modified: trunk\src\java\com\opensymphony\webwork\default.properties
          Modified: trunk\src\java\com\opensymphony\webwork\views\JspSupportServlet.java
          Modified: trunk\src\java\com\opensymphony\webwork\views\freemarker\FreemarkerManager.java
          Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh
          Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh\ApplyDecoratorBean.java
          Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh\ApplyDecoratorTransform.java
          Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh\SitemeshModel.java

          rgds

          Show
          tm_jee added a comment - I think someone with more insight of struts2 should take a look at this first cause there's a sitemesh plugin, should it belong there? the changes affect FreemarkerManager which is part of the core (I think). It sounds strange if part of this is in the plugin and part of it is in the core it uses webwork.properties, (which should be struts.properties equivalent but if not mistaken its being deprecated in favour of another configuration file) to decide if the sitemesh transform should be populated into freemarker's model. Maybe we should leave this with WebWork and not port it to struts2. The changes are :- Modified: trunk\src\java\com\opensymphony\webwork\WebWorkConstants.java Modified: trunk\src\java\com\opensymphony\webwork\components\Component.java Modified: trunk\src\java\com\opensymphony\webwork\default.properties Modified: trunk\src\java\com\opensymphony\webwork\views\JspSupportServlet.java Modified: trunk\src\java\com\opensymphony\webwork\views\freemarker\FreemarkerManager.java Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh\ApplyDecoratorBean.java Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh\ApplyDecoratorTransform.java Adding: trunk\src\java\com\opensymphony\webwork\views\sitemesh\SitemeshModel.java rgds
          Hide
          tm_jee added a comment -

          marking this as fixed for future, just in case someothers might want to have a go at it.

          cheers.

          Show
          tm_jee added a comment - marking this as fixed for future, just in case someothers might want to have a go at it. cheers.
          Hide
          Jonathan Doklovic added a comment -

          This is actually "almost" supported in 2.2.0
          Basically if you do something like:

          <#assign pg=JspTaglibs["http://www.opensymphony.com/sitemesh/page"]>
          ... some stuff here ...
          <@pg.applyDecorator page="/some-other-page.ftl" name="some-other-decorator" />

          in a freemarker decorator and the main result page you're decorating is a jsp page, it works.

          However, if the main result page you're decorating is a freemarker page, it doesn't.
          When you try to run it on a freemarker result, you don't get any errors, it just skips the content (possibly ignoring applyDecorator altogether)

          I've also been able to confirm that when trying this with a freemarker result, the JspTaglibs and the page.applyDecorator tags are available to freemarker

          Show
          Jonathan Doklovic added a comment - This is actually "almost" supported in 2.2.0 Basically if you do something like: <#assign pg=JspTaglibs ["http://www.opensymphony.com/sitemesh/page"] > ... some stuff here ... <@pg.applyDecorator page="/some-other-page.ftl" name="some-other-decorator" /> in a freemarker decorator and the main result page you're decorating is a jsp page, it works. However, if the main result page you're decorating is a freemarker page, it doesn't. When you try to run it on a freemarker result, you don't get any errors, it just skips the content (possibly ignoring applyDecorator altogether) I've also been able to confirm that when trying this with a freemarker result, the JspTaglibs and the page.applyDecorator tags are available to freemarker

            People

            • Assignee:
              Unassigned
              Reporter:
              tm_jee
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Development