Monday 14 July 2008

Spring Security (Acegi) and Sitemesh

Sitemesh is a great tool to decorate your java-based web page. I am currently using it to decorate my web application so that I can have the menu on the left panel, a header, and a footer withouth worrying about including it in all my jsp pages. Spring Security (formerly known as Acegi Security System) is another great tool that I also use together with Sitemesh for authentication and authorisation. My Spring Security "authorize" tag recently did not work properly, and the problem was because in my web.xml, I declared Sitemesh BEFORE Spring Security. Spring Security would clean up before Sitemesh is able to decorate the pages, causing Spring Security tags to stop working. The solution is to declare Sitemesh after Spring Security.

4 comments:

  1. Good tip. I reversed the filters in web.xml and my security tags are now working on my decorated pages.

    ReplyDelete
  2. Great tip! This saved me hours of frustration. Thanks.

    ReplyDelete
  3. Thanks, had exactly the same problem. Been tearing my hair for the last hours without getting anywhere...

    ReplyDelete

Share |