SiteMesh FAQ

#### How fast is SiteMesh?

Fast enough! SiteMesh typically has a 10-20 ms processing time, centering well around 10ms. You're more likely to have process timing issues in the pages being decorated.

#### Can I change rendering order on the fly like a portal with Sitemesh?

Yes. The decorator isn't hardcoded; it can choose what panels to include, and in what order, at runtime.

#### What languages can panels be made from?

Any active content your appllication server can create: CGI, PHP, JSPs, servlets, velocity pages, freemarker tages, Tea, etc.

#### What is the advantage of using SiteMesh over Struts Tiles?

Tiles seems to just replicate the <page:applyDecorator> tag (albeit without the advanced page parsing of SiteMesh). However this is a very small part of what SiteMesh.

The strongest attribute of SiteMesh is that the decorators are applied with a filter - therefore you can decorate pages without the pages themselves knowing they are being decorated (so you can apply a single SiteMesh decorator to a site that uses PHP, JSP and ASP if you want).

Also using DecoratorMappers you can map which decorator/s are used in a number of different ways (ie have one decorator for printable pages, another for robots and another for Netscape users - all without changing the underlying page).

That said, you can also alter which decorator is applied from the underlying page (note, the decorated page doesn't need to know it's being decorated - however if it does know it can pass parameters and choose decorators in SiteMesh - powerful).

Also SiteMesh has a full property system (ie decoratedPage.getTitle() or decoratedPage.getProperty(meta.description)) which allows you to build very advanced and flexible decorators.

More info available here.

#### Where can I find more information on Java Servlet 2.3 Filters?

- A JavaWorld article on filters by Jason Hunter
- IBM's developerWorks has an article on Tomcat Filters
- A step by step tutorial here by the OrionServer guys.

#### I need this functionality, but I want an offline version!

See StaticMesh.

#### What ports of are available?

- Microsoft .NET (stable) and ISAPI C++ (unstable): http://sf.net/projects/sitemesh/, see the wiki for more information.
- PHP-Mesh

#### Does SiteMesh support HTML frames?

If the FrameSetDecoratorMapper sits in the decorator chain (sitemesh.xml) the frame definition page and the frame pages are not decorated.

#### How do you get a reference to the (parent) request from inside an inline decorator?

You can use Page.getRequest() to access the HttpServletRequest of the original page.
For example:

> `<decorator:usePage id="p" />
> Path Info = <%= p.getRequest().getPathInfo() %>`

#### Is there a way for a decorator to pull a property (<page:param> value) via Java code, not just via the taglib?

You can access the Page.getProperty() method. A Page can be accessed either via a JSP tag, or through an attribute in the request.

> Example 1 (using JSP tag):

> `<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
> <decorator:usePage id="thePage" />
> <% String author = thePage.getProperty("meta.author"); %>`

> Example 2 (pure Java):

> `import com.opensymphony.module.sitemesh.Page;
> import com.opensymphony.module.sitemesh.RequestConstants;
> ...
> Page thePage = request.getAttribute(RequestConstants.PAGE);
> String author = thePage.getProperty("meta.author");`

> Example 3 (Velocity):

> $page.getProperty("meta.author")

#### Howcome I cannot decorate my error pages on Orion?

Orion applies filters incorrectly to error pages. For more information, consult the mail archives.

#### How do I enable SiteMesh to decorate error pages on Tomcat 5?

Replace the `<filter-mapping>` element in `web.xml` with this:

>     <filter-mapping>
>         <filter-name>sitemesh</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>REQUEST</dispatcher>
>     </filter-mapping>