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

          No work has yet been logged on this issue.

            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