“Extras” starts tonite. Ricky Gervais’ new TV show Adblocking Akamai
Jul 22

Dealing with frustrating bugs with Sitemesh and MyFaces JSF

Java, Tech Add comments

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, and all that rewriting of html ;)) in the decorator.

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!

2 Responses to “Dealing with frustrating bugs with Sitemesh and MyFaces JSF”

  1. denis Says:


    I’m French from Paris.

    I don’t understand your action with the filter.
    I use AppFuse (JSF, sitemesh, spring, hibernate), and it’s right i have a problem when i call jsf in header or other page is not the main :

    - header
    default – main (jsf content)
    - footer

    i want use JSF in all jsp page mapping with sitemesh decorator, main but although default, header and footer.

    How can i do ? As you can imagine it’s importante for me.


  2. Gunjan Says:

    I got the same problem ….
    Is some body help me ……..

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)