使用siteMesh Struts2 Tomcat 6排除页面的问题

时间:2011-02-03 15:47:51

标签: java tomcat struts2 sitemesh

我在Apache-Tomcat 6.0.29中使用Struts2.2.1.1和sitemesh 2.4.1。 它工作正常,但我无法从siteMesh中排除文件。

我在WebContent / jsp / decorators中有我的装饰器,但我想要排除文件WebContent / jsp / forms / Authentication.jsp。我尝试使用这个decorators.xml和默认的dir =“/ jsp / decorators”:

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

我还尝试将模式标记更改为使用/jsp/forms/Authentication.jsp,但也无法正常工作。任何人都可以给我一些正确方向的指示吗?非常感谢。

Juan David

1 个答案:

答案 0 :(得分:2)

除了您拥有的内容之外,还需要在excludes文件中配置sitemesh.xml,如下所示: -

<强> 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>
相关问题