Problem excluding pages with siteMesh Struts2 Tomcat 6

3.8k views Asked by At

I'm using Struts2.2.1.1 with sitemesh 2.4.1 in Apache-Tomcat 6.0.29. It works fine, but i can't exclude a file from siteMesh.

I Have My decorators in WebContent/jsp/decorators but i want to exclude the file WebContent/jsp/forms/Authentication.jsp. I tried using this decorators.xml with default dir = "/jsp/decorators":

<excludes>
    <pattern>../forms/Authentication.jsp</pattern>
</excludes>
<decorator name="main" page="layout.jsp">
    <pattern>/*</pattern>
</decorator>

I also tried to change pattern tag to use /jsp/forms/Authentication.jsp and didn't work either. Could anyone give me some pointers in the right direction? thanks a lot.

Juan David

1

There are 1 answers

5
limc On

In addition to what you have, you need to configure the excludes in your sitemesh.xml file, like this:-

decorator.xml

<decorators>
   <excludes>
      <pattern>../forms/Authentication.jsp</pattern>
   </excludes>
   <decorator name="main" page="layout.jsp">
      <pattern>/*</pattern>
   </decorator>
</decorators>

sitemesh.xml

<sitemesh>
    <property name="decorators-file" value="/WEB-INF/decorators.xml" />
    <excludes file="${decorators-file}" />

    <page-parsers>
        <parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
        <parser content-type="text/html;charset=ISO-8859-1" class="com.opensymphony.module.sitemesh.parser.HTMLPageParser" />
    </page-parsers>

    <decorator-mappers>
        <mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
            <param name="config" value="${decorators-file}" />
        </mapper>
    </decorator-mappers>
</sitemesh>