jfu
jfu

Reputation: 31

SiteMesh 2.4.2 + Spring MVC 3.0.4 - using multiple decorators

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

Upvotes: 3

Views: 3405

Answers (2)

sappenin
sappenin

Reputation: 225

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).

Upvotes: 0

miguelr
miguelr

Reputation: 1344

Include the * symbol before the line

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

Upvotes: 1

Related Questions