Two usefull sitemesh resources:
- Paul Codding's blog entry: 'Spring, Hibernate, and Sitemesh' (Note: Website has been taken offline)
- SiteMesh - Building SiteMesh Decorators
Weaving sitemesh into pebble.
Add the sitemesh PageFilter
into WEB-INF/web.xml
:
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Prepare the pebble template.jsp
is as easy as replacing the built-in template mechanism
<%-- the main area into which content gets rendered --%>
<div id="content">
<template:content/>
</div>
with the sitemesh pendant:
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
...
<div class="docBody">
<decorator:body />
</div>``
And register the template.jsp
as main decorator in WEB-INF/decorators.xml
:
<decorators defaultdir="/themes/default">
<decorator name="main" page="template.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>``
The OSGi configuration in MANIFEST.MF
com.springsource.com.opensymphony.sitemesh;bundle-version="2.3.0"
This post is part of a series about an OSGi experiment: Migrate a monolith to a modular OSGi application architecture.
▷ The Beginning of an OSGi Experiment
▷ Building OSGi ready pebble with Maven
▷ Extracting the first OSGi bundle
▷ Extracting the E-Mail Service
▷ Adding an OSGi command (Equinox)
▶︎ The tale of a sitemesh experiment
▷ In the middle of an OSGi experiment
▷ ...
Header cover Photo by Matthew Henry from Burst