Re: Adding common header to all JSP pages
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: Thu, 10 Feb 2005 06:28:57 -0600
"Maxim Senin/J2EE Experts at www.supremistic.com" <email@example.com>
wrote in message news:firstname.lastname@example.org...
> I have a website built with JSP on tomcat 3.2. Currently is uses HTML
> frames for header/body/footer. I want to "flatten" it by getting rid of
> header and footer frames.
Good for you. Frames in general are going away.
> I don't want to do jsp:include or anything like that in every page.
> Stylesheets may not work too: some pages can be displayed on their own, or
> same page can be included into another page, so if I did <jsp:include> on
> every page I'd get duplicated headers/footers.
Look at Tiles. I've only used it as a plug-in for Struts, which I'd also
recommend, but it can be used separately. This might help you start learning
Off-hand, I can't tell you how to set up up independently of Struts.
> I think that the following would work for me: if I could setup some kind of
> filter for text/html content, that filter would prepend header and append
> footer to ALL pages serving text/html mime type, and i'd do it only once per
> So how can I set up such a filter in tomcat 3.2? Do I need to change
> web.xml/server.xml or any other configuration files or deployment descripor?
> Is there any other way to do it?
That would be an unusual approach. The concept of filtering is not really for
appending/prepending content to pages.