- SiteMesh is much easier to configure and use (less typing and easier to understand)
- Using Tiles, you need to have your forwards go to a "tiles page" versus the direct JSP. SiteMesh takes the approach that your page (your JSP) doesn't even know or care that it's being decorated.
- Using Tiles, each individual page you want to go to has to be associated with a layout - Major pain! Every time you create a new JSP that you want to forward to, you have to create another tiles definition and associate it with a layout and forward to the Tile page (versus the JSP). With SiteMesh you can simply set up a URL pattern and all your pages are decorated with the layout you choose.
You can read this http://today.java.net/pub/a/today/2004/03/11/sitemesh.html post by Will Iverson about how to use SiteMesh.
One way to overcome the sitemesh limitation is to create a two page sequence. Page one creates a AJAX or IFrame call back to page two, which in turn runs through the servlet to get the rest of the page. But with this approach you need to make sure that the second page you call won't get decorated. You don't want to decorate the content the second time around. In this way, the first page content is a light weight page and the second page does all the work. Also with this approach, you need to special attention to security. You don't want to create a hole where someone can maliciously scrape all your content from your database with modifying certain parameters and re-posting similar data to the servlet that renders the second page's call.
ReplyDeleteIIRC, SiteMesh can't not be used for portlets, while Tiles can be :-)
ReplyDeletesitemesh is using the decorator pattern, which is considered slower than composite view pattern(tiles),in performance.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis article goes into a number of advantages Tiles-3 has over SiteMesh.
ReplyDeleteAlong with advantages the Composite pattern has over the Decorator pattern.
the ultimate view – Tiles-3