Just to make you more confused, here is another alternative, which we use: You can put the template (header and footer) in custom tags. The tag can either print the template with pageContext.getOut().print() or include a tempalte file.
You can do it like this <template:header /> Page content <template:footer /> Or use both doStartTag and doEndTag like this <template:template> Page content </template:template> (I prefer the latter, for example since it's somewhat "safer" that you do not forget either opening or closing any tag. > -----Original Message----- > From: A mailing list about Java Server Pages specification and reference > [mailto:[EMAIL PROTECTED]]On Behalf Of Joel Carklin > Sent: Friday, January 10, 2003 8:39 AM > To: [EMAIL PROTECTED] > Subject: advice on jsp include > > > Hi all, > > I have a web app in which all the pages have exactly the same header, > side bar and footer. At first I was going to make these 3 seperate jsp > files and use a jsp include, (probably the <%@ include %> since the > pages won't change?). > > Then the web designer returned a 'template' to me which had all 3 on one > page, laid out, with an area, a table cell which contains the actual > difference for each page, the idea being that if I have 10 different > pages I can make 10 copies of the template and just fill in the table > cell. So then I thought, what about just having the one 'template' page > which all the webapp links reference, and include the portion that > changes, using the include statement and using a request attribute to > tell the page what to include. For example like this: > > <c:choose> > <c:when test="${showPage=='Page1'}"> > <jsp:include flush="true" page="_page1.jsp"/> > </c:when> > <c:when test="${showPage=='Page2'}"> > <jsp:include flush="true" page="_page2.jsp"/> > </c:when> > <c:when test="${showPage=='etc'}"> > <jsp:include flush="true" page="_etc.jsp"/> > </c:when> > <c:otherwise> > <jsp:include flush="true" page="_login.jsp"/> > </c:otherwise> > </c:choose> > > I hope I being clear. > > I guess what I'm asking is the pro's cons of such a setup. I haven't > really seen anyone else doing it and am wondering if this is because it > increases compilation time significantly or something else I don't know > about. Is there a better way to do it? > > Any comments / criticisms appreciated > > Thanks > Joel > > ================================================================== > ========= > 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 > =========================================================================== 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