How do I have two or more web applications share the same template file (i.e. wrapper around content) so that I would not duplicate code and have two template files?

Alessandro A. Garbagnati

One solution is to store the templates in a common directory and pass the directory as a parameter to the two contexts (using web.xml). This will work only if the two applications are located on the same server and will not be moved.

A better solution could be to store the template files into a database, so that even if you increase the number of applications, you balance them on different servers and don't have to change the code.