使用 siteMesh Struts2 Tomcat 6 排除页面时出现问题

发布于 2024-10-16 03:22:23 字数 553 浏览 2 评论 0原文

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

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

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

我还尝试更改模式标记以使用/jsp/forms/Authentication.jsp,但也不起作用。有人能给我一些正确方向的指示吗?多谢。

胡安·大卫

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

开始看清了 2024-10-23 03:22:23

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

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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文