sitemesh排除故障

时间:2011-11-29 11:00:48

标签: sitemesh

这是我的sitemesh-decorators.xml文件内容

<decorators defaultdir="/WEB-INF/sitemesh">
    <excludes>
        <pattern>*.html*</pattern>
        <pattern>*.json*</pattern>
        <pattern>*.xml*</pattern>
        <pattern>*.download*</pattern>
        <pattern>/WEB-INF/views/dashboard/dashboard.jsp</pattern>
    </excludes>

    <decorator name="minimal" page="minimal.jsp">
        <pattern></pattern>
    </decorator>

    <decorator name="none" page="none.jsp">
        <pattern></pattern>
    </decorator>

    <decorator name="default" page="default.jsp">
        <pattern>*</pattern>
    </decorator>

</decorators>

但是不排除仪表板,任何想法,我试图通过添加单个页面来改变“默认”标签的模式,但没有效果。

我也试图在'none'标签中输入exclude jsp页面。有没有人有定制它的经验?

3 个答案:

答案 0 :(得分:2)

我将sitemesh-decorator.xml改为

<decorators defaultdir="/WEB-INF/sitemesh">
    <excludes>
        <pattern>*.html*</pattern>
        <pattern>*.json*</pattern>
        <pattern>*.xml*</pattern>
        <pattern>*.download*</pattern>
    </excludes>

    <decorator name="minimal" page="minimal.jsp">
        <pattern></pattern>
    </decorator>

    <decorator name="none" page="none.jsp">
        <pattern></pattern>
    </decorator>

    <decorator name="default" page="default.jsp">
        <pattern>*</pattern>
    </decorator>

    <decorator name="dashboard" page="/WEB-INF/views/dashboard/dashboard.jsp"/>

</decorators>

并使用

<meta name="decorator" content="dashboard">

在我的dashboard.jsp的头部,它就可以了。

这是最好的方式吗?

答案 1 :(得分:0)

我有同样的问题,我通过这种方式解决了添加一个名为&#34; no&#34;的新装饰:

<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/WEB-INF/layouts/">
    <excludes>
        <pattern>/static/*</pattern>
        <pattern>/api/*</pattern>
        <pattern>/</pattern>
    </excludes>
    <decorator name="default" page="default.jsp">
        <pattern>/*</pattern>
    </decorator>
    <decorator name="no" page=""></decorator>
</decorators>

并将元添加到您不想使用装饰器的页面:

<meta name="decorator" content="no" />

答案 2 :(得分:-1)

我们可以像这样添加:

<mapping path="/Login" exclue="true"/>

请参阅http://wiki.sitemesh.org/wiki/display/sitemesh3/Configuring+SiteMesh+3