You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Van Riper <va...@gmail.com> on 2007/08/07 02:24:03 UTC

[S2] Successfully migrated my WW-2.2 app to Struts-2.0.9

I had one last hiccup with the Sitemesh integration on S2. Although I
am using the default JSP approach and didn't need the template support
for Freemarker or Velocity provided by the Sitemesh plugin for S2, I
did need to add the ActionContextCleanUp filter to my web.xml as
recommended as part of this documentation for the sitemesh plugin that
supports templating:

http://struts.apache.org/2.0.9/docs/sitemesh-plugin.html

Until I added the ActionContextCleanUp filter, I was getting an NPE
for the first S2 tag encountered in my Sitemesh decorator JSP. My
final working web.xml filter settings/mappings (not using the
struts2-sitemesh-plugin though) are:


    <!-- This filter allows sitemesh decorator's to access struts
framework variables -->
    <filter>
        <filter-name>struts-cleanup</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
    </filter>

    <!-- sitemesh gives us an overall page/panel definition -->
    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
    </filter>

    <!-- Struts is attached as the last filter.
          Note that this must be placed AFTER other related filters
          (like SiteMesh) because if this succeeds and decides to send
          the request to struts, the rest of the filter chain is stopped.
      -->
    <filter>
        <filter-name>struts</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts-cleanup</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>struts</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

I'm not sure why, but, I didn't need the extra cleanup filter for the
WW-2.2 app.

I may still run into some other minor hiccups during a full regression
test run, but, things are basically working now. This was done on a
SVN branch, but, I should be able to make the same changes in a matter
of hours (thanks to IntelliJ) on our main trunk later this week after
completing my regression testing on the branch. Phew!

-Van

Mike "Van" Riper
van_riper@dev.java.net

Silicon Valley Web Developer JUG
https://sv-web-jug.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org