SiteMesh 2

How to integrate Sitemesh into web application:

Add sitemesh into web app:

  • 1) Add sitemesh dependency

a) drop sitemesh.jar into WEB-INF\lib
b) use maven

  • 2) Add Filter to web.xml
<!-- SiteMesh -->

  • 3) Create decorators.xml file
    <?xml version="1.0" encoding="UTF-8"?> 
    <decorators defaultdir="/decorators"> 
        <decorator name="basic-theme" page="basic-theme.jsp"> 
  • 4) Use Sitemesh tag libs inside the theme jsp files:
    <%@ taglib uri="" prefix="decorator" %>
    <decorator:body />


  • sitemesh-defaul.xml expects decorators to be at : /WEB-INF/decorators.xml
  • Theme locations are specified in decorators.xml : <decorators defaultdir="/decorators">
  • File structure:



Posted in Java, Web

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: