A project that I am joining is using MyFaces implementation of JSF, and Sitemesh for decoration (I am a big fan of Sitemesh).
There is a known problem, where you can not put JSF code (you know,
However, we were running into a problem where even if the decorated page had JSF tags in it the app would freak out and you would get no HTML response.
The JSF code was running, as the log file was showing us that.
We dropped in the JSR RI and it all worked fine, so I thought it may be a MyFaces bug. However, MyFaces works in AppFuse and the like.
This is where a debugger kicked in, where TDD wouldn’t really help as much.
After walking the stack I saw that the MyFaces extensions filter was freaking it all out. When I took that out of the filter chain all worked well.
The problem wasn’t actually the extensions filter itself though, the problem was the order of the filters defined via filter-mapping’s in the web.xml.
Since Sitemesh is doing magic on the entire chain you should put the filter-mapping at the beginning, as then the container will run it first… and it will then chain.doFilter()…. which will do its thing and when it unravels, Sitemesh will be the last to finish up.
Gotta love debugging fluff like this!