3

I'm developing an application that uses SiteMesh 2.4.2 together with Spring MVC.

I'd like to have two decorators, e.g. :

<decorators>
  <decorator name="special" page="/WEB-INF/jsp/specialtemplate.jsp">
    <pattern>/something/*</pattern>
  </decorator> 

  <decorator name="main" page="/WEB-INF/jsp/pagetemplate.jsp">
    <pattern>/*</pattern>
  </decorator>
</decorators>

The problem is that only the main decorator is applied (also for pages /something/...)

How should I properly configure the decorators, so that for pages from /something/... the dedicated one is used?

the urls I'd like to use the specific template looks like http://server/context/something/etc

Community
  • 1
  • 1
jfu
  • 31
  • 1
  • 2

2 Answers2

1

Include the * symbol before the line

<decorator name="special" page="/WEB-INF/jsp/specialtemplate.jsp">
    <pattern>*/something/*</pattern>
</decorator> 
miguelr
  • 1,334
  • 14
  • 21
0

This problem was happening for me, too, yet the answer from miguelr didn't work in my case.

I am using urlRewriteFilter (org.tuckey.web.filters.urlrewrite.UrlRewriteFilter) in addition to Sitemesh.

Once I declared the Sitemesh filter-mapping above the urlRewriteFilter filter-mapping in web.xml, sitemesh started working properly (i.e., it would pick up my other decorator URL pattern correctly).

sappenin
  • 225
  • 3
  • 12