Question

I have tried to set up a simple sitemesh decorated page, but am running into a wall now.

First, my setup:

#decorators.xml
<?xml version="1.0" encoding="UTF-8"?>
<decorators>
    <decorator name="basicLayout" page="/WEB-INF/views/layout.jsp">
        <pattern>*</pattern>
    </decorator>
</decorators>

Nothing special here

#web.xml
<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
   <filter-name>sitemesh</filter-name>
   <url-pattern>*.jsp</url-pattern>
</filter-mapping>

Nothing special there

When I call the index of the application, it gets decorated. When I click a link calling a controller that returns a view, the returned view does not get decorated. Actually, this only works for the welcome-file at the moment. I tried different decorator pattern, the result is either the same or an excepton :D

Can someone give me a hint on this?

Thanks!

Was it helpful?

Solution

for sitemesh view decoration it considers "main" template as default. so if you don't specify any template in your JSP (to be decorated) then it takes defination as main from decorator.xml.

if you are going to have only one template in your application (very less chances) then rename decorator name from basicLayout to main.

if not then you can use in JSP to specify which decorator to be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top