开发者

Problem excluding pages with siteMesh Struts2 Tomcat 6

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 trie开发者_如何学God 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


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜