Sitemesh3 Decorator only works with JSP extension

357 views Asked by At

I'm using Sitemesh3 and I can only get it to decorate views WITH a JSP extension. Normal extensionless actions don't get decorated.

For example:

http://localhost:8080/index [No decoration]

http://locathost:8080/index.jsp [Gets decorated]

~~

What am I missing?

=======

sitemesh3.xml

<sitemesh>
    <mapping>
        <path>/*</path>
        <decorator>/WEB-INF/decorators/master.jsp</decorator>
    </mapping>
</sitemesh>

======

web.xml

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>org.sitemesh.config.ConfigurableSiteMeshFilter</filter-class>
</filter>

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

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

=====

struts.xml

<struts>
    <constant name="struts.devMode" value="true" />

    <package name="default" extends="struts-default">
        <action name="index">
            <result>/index.jsp</result>
        </action>
    </package>
</struts>

======

File Structure

webapp
|- WEB-INF
|- |- master.jsp
|- |- sitemesh3.xml
|- index.jsp
1

There are 1 answers

0
Kyle Martin On

The Sitemesh filter-mapping needed to be changed like so:

<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>