views:

58

answers:

1

I have a multi WAR web application that was designed badly. There is a single WAR that is responsible for handling some authorization against a database and defines a standard web page using a jsp taglib. The main WAR basically checks the privileges of the user and than based on that, displays links to the context path of the other deployed WARS. Each of the other deployed WARs includes this custom tag lib.

I am working on redesigning this application, and one of the nice things that I want to retain is that we have other project teams that have developed these WAR modules that "plug into" our current system to take advantage of other things we have to offer.

I am not entirely sure how to handle the page templates though. I need a templating system that would be easy enough to use across multiple wars (I was thinking of jsp fragments??). I really only need to define a consistent header and main navigation section. Whatever else is displayed on the page is up to the individual web project.

Any suggestions?

I hope that this is clear, if not I can elaborate more.

+1  A: 

Have done something similar in the past using Sitemesh

we defined a new web app called skins-app which only has the common header, footer, navbar which all other need. Sitemesh is configured via a file named WEB-INF/decorators.xml in the skins-app

then in any consuming webapp, you add a WEB-INF/decorators.xml as well.

And point your pages to be 'decorated' by the skins from another app

<decorator name="main" page="/decorators/layout.jsp" webapp="skins-app">  
<pattern>/*</pattern> 
</decorator>

You can have detailed include/exclude as well in your consuming webapp, if any pages needed to be excluded from the 'decoration'. Take a look at the Visual Example on the Sitemesh link page.

JoseK
this looks really cool, I will have to check it out in more detail.
Casey