Use Sitemesh, http://opensymphony.com/sitemesh/ - works wonders for stuff like this.
>From: Soefara Redzuan <[EMAIL PROTECTED]> >Reply-To: A mailing list about Java Server Pages specification and >reference <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Better way to build a site than or with JSPs ? >Date: Wed, 27 Feb 2002 14:39:02 +0800 > >I've experimented and have found one way to templated site with JSP but >there has to be a better way. First, I'll explain what I do at the moment. >Consider a very simplistical sitemap ~ > >Homepage >+-Company >+-Products >+-Services >+-Feedback > >I've created a folder structure to represent this. And the default page in >each folder is index.jsp. Each page (index.jsp) shares the same banner >(Banner.jsp), footer (Footer.jsp) and navigation menu (Menu.jsp) which go >in >the Global folder. So, this gives me the following ~ > >index.jsp (Homepage) >\Company\index.jsp >\Products\index.jsp >\Services\index.jsp >\Feedback\index.jsp >\Global\Banner.jsp > \Menu.jsp > \Footer.jsp > >So far, so good. Next, to make it easier to edit the content on each page >and to make it easier to have uniform consistency of pages, EVERY index.jsp >is IDENTICAL ~ > >index.jsp >--------- ><%@ include file="/Global/Banner.jsp" %> ><table> > <tr> > <td><%@ include file="/Global/Menu.jsp" %></td> > <td><%@ include file="body.jsp" %></td> > </tr> ></table> ><%@ include file="/Global/Footer.jsp" %> > > >Using this, the final file structure is ~ > >index.jsp (Homepage) >body.jsp >\Company\index.jsp > \body.jsp >\Products\index.jsp > \body.jsp >\Services\index.jsp > \body.jsp >\Feedback\index.jsp > \body.jsp >\Global\Banner.jsp > \Menu.jsp > \Footer.jsp > > >And you know, this system works for me. To edit any page, all I have to do >it edit the body.jsp which means that I have little risk of messing up the >template. > >The problem with this is obviously all those identical index.jsp's !! If I >have to make a change to the layout, then I have to change all of them. >That's obviously BAD but is a simple search/replace because they're all >identical anyway. > >I know I can use Velocity within JSP in order to use one template for all >the JSPs but I still end up with literally hundreds of identical index.jsp >pages for a real site with many levels of subdirectories. It'll be easier >to >change the template for layout but really whenever I see repetition on the >scale of all those index.jsp's I think something's inefficient. > >There has to be a better way of doing this, is there ? > >Soefara. > >_________________________________________________________________ >Chat with friends online, try MSN Messenger: http://messenger.msn.com > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST >DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > >http://archives.java.sun.com/jsp-interest.html >http://java.sun.com/products/jsp/faq.html >http://www.esperanto.org.nz/jsp/jspfaq.jsp >http://www.jguru.com/faq/index.jsp >http://www.jspinsider.com ----------------------------------------------- Joseph B. Ottinger [EMAIL PROTECTED] http://enigmastation.com IT Consultant _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
