2011-02-03 37 views
0

我在Apache-Tomcat 6.0.29中使用Struts2.2.1.1和sitemesh 2.4.1。 它工作正常,但我不能從siteMesh排除文件。用siteMesh Struts2除去頁面的問題Tomcat 6

我在WebContent/jsp/decorators中有我的裝飾器,但我想排除文件WebContent/jsp/forms/Authentication.jsp。我嘗試使用這個decorators.xml默認DIR =「/ JSP /裝修」:

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

我也試圖改變格局的標籤使用/jsp/forms/Authentication.jsp並沒有擦出火花。任何人都可以給我一些正確的方向嗎?非常感謝。

胡安·大衛

回答

2

除了你有什麼,你需要在你的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> 
+0

感謝您回答我的問題,但是我已經在WEB-INF/sitemesh.xml中創建了一個包含您發佈內容的文件。而且它也不工作。它可能是別的嗎?謝謝 – 2011-02-03 15:58:46