This tutorial teaches you how to set up SiteMesh within a Java Web Development Environment and should take about 5 minutes or less.
Demo Web Application
If you plan to follow along the tutorial, you will want to setup your web application with the context root of cafe a fictional Café in Aix-en-Provence.
Install SiteMesh Manually
Installing SiteMesh into your web application consists of three steps,
- Add the SiteMesh library file to WEB-INF/lib
- Add the SiteMesh filter to web.xml
- Create a blank decorators.xml file
Setup Library File
Copy the SiteMesh jar file into your web application's WEB-INF/lib directory. In this example we downloaded SiteMesh 2.4.1 which uses the jar name, sitemesh-2.4.1.jar.
Add SiteMesh Filter
Add the following to WEB-INF/web.xml within the <web-app> tag and make sure it sits below any other filters you may have,
Here is a sample web.xml,
Add Decorator Controller File
Create the a decorators.xml file in your WEB-INF directory,
If you start up your application server (container) and get no errors then SiteMesh is is ready to go. However, SiteMesh will not do anything yet. Continue to Start Using SiteMesh in 10 minutes.