Struts 2
  1. Struts 2
  2. WW-3296

Full integration with SiteMesh 2 + Freemarker 2.4.2 + Velocity 1.3 , including struts tags, value stack, and FreemarkerManager statics.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.8
    • Fix Version/s: 2.2.1
    • Component/s: Plugin - SiteMesh
    • Labels:
      None
    • Flags:
      Patch, Important

      Description

      Current issues include:

      • limiting decorators to use 1 technology (Freemarker, Velocity, or JSP) only. SiteMesh should be able to use any of the three decorators as definied in decorators.xml
      • velocity struts tags and toolchain not available to velocity decorators, .
      • freemarker statics and manager configuration not available to freemarker decorators.
      • in general, the decorators use a completely different manager.
      • problems mixing freemarker decorators with velocity/jsp results and vice versa.

      This improvement/patch will use the SiteMeshFilter provided by SiteMesh and implement a Freemarker and Velocity dispatcher that uses the appropriate Managers in Struts 2 to create their contexts and configurations, as well as share the same model when available. If the context has not been created for that technology, the Struts Manager will be asked to construct one. Since many of these configurations were constructed multiple times, there should be a small speed improvement as well. Once implemented, there will not be a restriction on decorators.xml on which technology is being used, and the same context will be available to the decorators as is available to the results.

      The new web.xml will look like this (configuration to use all three technologies).

      <filter>
      <filter-name>struts-prepare</filter-name>
      <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
      <init-param>
      <param-name>actionPackages</param-name>
      <param-value>net.stonescape.renegade20.presentation</param-value>
      </init-param>
      </filter>

      <filter>
      <filter-name>sitemesh</filter-name>
      <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
      </filter>

      <filter>
      <filter-name>struts-execute</filter-name>
      <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
      </filter>

      <filter-mapping>
      <filter-name>struts-prepare</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping>
      <filter-mapping>
      <filter-name>sitemesh</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>
      <filter-mapping>
      <filter-name>struts-execute</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping>

      <servlet>
      <servlet-name>sitemesh-freemarker</servlet-name>
      <servlet-class>org.apache.struts2.sitemesh.FreemarkerDecoratorServlet</servlet-class>
      <init-param>
      <param-name>default_encoding</param-name>
      <param-value>UTF-8</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
      <servlet-name>sitemesh-freemarker</servlet-name>
      <url-pattern>*.ftl</url-pattern>
      </servlet-mapping>

      <servlet>
      <servlet-name>sitemesh-velocity</servlet-name>
      <servlet-class>org.apache.struts2.sitemesh.VelocityDecoratorServlet</servlet-class>
      <init-param>
      <param-name>default_encoding</param-name>
      <param-value>UTF-8</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
      <servlet-name>sitemesh-velocity</servlet-name>
      <url-pattern>*.vm</url-pattern>
      </servlet-mapping>

      <servlet>
      <servlet-name>JspSupportServlet</servlet-name>
      <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>

        Issue Links

          Activity

          Christian Wolfgang Stone created issue -
          Christian Wolfgang Stone made changes -
          Field Original Value New Value
          Assignee Christian Wolfgang Stone [ xtianstone ]
          Christian Wolfgang Stone made changes -
          Link This issue contains WW-2865 [ WW-2865 ]
          Christian Wolfgang Stone made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          musachy made changes -
          Link This issue contains WW-3291 [ WW-3291 ]
          Jeff Turner made changes -
          Project Import Mon Feb 01 01:17:42 UTC 2010 [ 1264987062082 ]
          Christian Wolfgang Stone made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Fix Version/s 2.1.9 [ 12314678 ]
          Resolution Fixed [ 1 ]
          Lukasz Lenart made changes -
          Fix Version/s 2.2.0 [ 12314680 ]
          Fix Version/s 2.1.9 [ 12314678 ]
          Lukasz Lenart made changes -
          Fix Version/s 2.2.1 [ 12315170 ]
          Fix Version/s 2.2.0 [ 12314680 ]
          Lukasz Lenart made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Christian Wolfgang Stone
              Reporter:
              Christian Wolfgang Stone
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development