SiteMesh passed the 10 minute test
I decided to go out on a limb this evening and give SiteMesh a run for its money. The first warning sign was that the documentation refers to version 2.0.2, while the downloads section refers to version 2.0.1. So I proceeded to download 2.0.1. I promptly noticed that the install guide indicated I needed to download SiteMesh's two TLDs and configure them in my web.xml. Blech - this is so year 2000 - most modern containers support loading taglibs from JAR files with a URI.
So I did a good ol' cvs co of sitemesh from java.net. First of all, I'd like to say kudos to java.net and their CVS repositories - they've been rock solid for the few weeks I've used them. After checking out sitemesh, the first thing on my agenda was to give it the tried n' true ant test. This means I navigate to the sitemesh folder and simply type "ant". At this point, I should get one of two things - a BUILD SUCCESSFUL with a JAR or a help message telling me what I should type. I got the former, which I prefer.
After this, I integrated it into my app using the decorators documentation and deployed it. At first, I received the lovely ol' "getOutputStream() has already been called for this response" error, so I hacked PageFilter.java to use PrintWriter writer = response.getWriter();
instead of PrintWriter writer = new PrintWriter(response.getOutputStream());
. Build, copy, package, deploy and voila - it all worked!! Wow that was easy. ;-)
Here's the weird part. I decided to reverse my hack on PageFilter.java to prove that I'd actually fixed the bug. Now I'm back to the original code I got from CVS and I can't get the getOuputStream() error to rear its ugly head. Doh!! This experience begs the following question.
Is SiteMesh stable enough on Tomcat 5 that I can should use it in my Spring Live sample app?
SiteMesh definitely passed my 10 minute test, we'll see if it holds up for the long haul. So far, I'm quite impressed with its easy configuration and quick implementation. I especially like that you can literally guess at it's syntax and you'll get it right. Maybe I was just lucky...
P.S. You should probably know I'm a big fan of Tiles. I wonder if SiteMesh will let me switch a decorator on the fly like Tiles does?
Posted by Mathias Bogaert on March 24, 2004 at 10:46 AM MST #
Posted by Joseph Ottinger on March 24, 2004 at 11:56 AM MST #
JSP page authoring tools and JSP containers are required to accept a tag library that is packaged as a JAR file. When deployed in a JSP container, the standard JAR conventions described in the Servlet 2.3 specification apply, including the conventions for dependencies on extensions.
Packaged tag libraries must have at least one tag library descriptor file. The JSP 1.1 specification allowed only a single TLD, in META-INF/taglib.tld, but in JSP 1.2 multiple tag libraries are allowed. See Section JSP.7.3.1 for how TLDs are identified.
Posted by Matt Raible on March 24, 2004 at 02:56 PM MST #
Posted by Joseph Ottinger on March 24, 2004 at 05:58 PM MST #
Posted by Will Gayther on March 24, 2004 at 08:02 PM MST #
If SiteMesh can pass Matt's 10-minute test, I guess it's worth checking out. Mathias/Joe: when does it look like 2.1 will be done?
Posted by gerryg on March 24, 2004 at 08:26 PM MST #
Posted by Jon Pierce on March 25, 2004 at 12:24 AM MST #
Posted by Mike on March 25, 2004 at 03:07 PM MST #
Posted by gerryg on March 25, 2004 at 05:53 PM MST #
Gerry - it should be noted that Tomcat is *not* the reference implementation for Servlets and JSPs. See this post (at the bottom). As for its incompatibilities, I've had *way* more compatibility issues with other containers than Tomcat. Especially with the J2EE 1.4 bleeding-edge type stuff.
Posted by Matt Raible on March 25, 2004 at 06:17 PM MST #
Posted by gerryg on March 25, 2004 at 08:06 PM MST #
Posted by Mathias Bogaert on March 25, 2004 at 10:24 PM MST #
Posted by Ian Gower on August 04, 2004 at 02:35 PM MDT #
Posted by Matt Raible on August 04, 2004 at 03:19 PM MDT #
Hi - I am having a problem with the Equinox SiteMesh setup, and since I know you check your blog entry comments (and your email is not immediately obvious), I figured I would drop the message here. Whenever I try to navigate to a page through a Struts forward, I hit something like:
<code> 2004-10-10 09:31:23 StandardWrapperValve[default]: Servlet.service() for servlet default threw exception java.lang.NullPointerException at com.opensymphony.module.sitemesh.filter.PageResponseWrapper.getPage(PageResponseWrapper.java:263) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:147) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:58) </code>Have you seen this before?
Posted by Scott McClure on October 10, 2004 at 01:51 PM MDT #
Posted by Matt Raible on October 10, 2004 at 02:29 PM MDT #