You could also look at sitemesh, from opensymphony
(http://www.opensymphony.com/), which would solve your particular problem
very elegantly. Each page gets rendered to simple HTML:

<html>
<head>
<title>My Page Here</title>
</head>
<body>
Custom content!
</body>
</html>

And SiteMesh dresses it up by sticking it inside a table (if you like) or in
any other context you want. Neat thing: if you have an .html page, the URI
points to the HTML page, and not some processor (unless that's really what
you want.)

I use Sitemesh a lot - very nice product.


>From: Dave Ford <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Standar Template
>Date: Thu, 10 May 2001 12:16:44 -0700
>
>I want to create a web app in which every page on the site has a standard
>header along the top and a standard menu along the left edge (a pretty
>standard thing).
>
>I came up with 2 ways of doing this:
>
>1. Use a table tag and jsp:include tags on EVERY page:
>
><table>
>   <tr>
>     <td><jsp:include page="standardHeader.jsp"/></td>
>   </tr>
>   <tr>
>     <td colspan="2">
>     <table>
>       <tr>
>         <td valign="top"><jsp:include page="/menu.jsp" /></td>
>         <td valign="top">
>          THIS IS WHERE THE PAGE-SPECIFIC CONTENT (i.e. the body)*
>         </td>
>       </tr>
>     </table>
>     </td>
>   </tr>
></table>
>
>2. Invert the above solution to create one master template (or controller)
>and have the content page name passed in as a parameter. Here would be the
>master template-controller page:
>
><table>
>   <tr>
>     <td><jsp:include page="standardHeader.jsp"/></td>
>   </tr>
>   <tr>
>     <td colspan="2">
>     <table>
>       <tr>
>         <td valign="top"><jsp:include page="/menu.jsp" /></td>
>         <td valign="top">
>          <jsp:include page="<%=request.getParameter("contentPage")%>" />*
>         </td>
>       </tr>
>     </table>
>     </td>
>   </tr>
></table>
>
>The key difference between these two architectures are best understood by
>looking at the 2 lines with the * at the end. Also, in option 2, there is
>only one copy of the above code. In option 1, there is one copy "per
>content
>page"
>
>Q1: Does anyone have any preference between options 1 and 2?
>Q2: Is there a better way of achieving this result?
>Q3: Do either have any negetive drawback I need to consider? (I will be
>converting an entire site)
>
>By the way, I'm currently achieving this effect VERY easily using good old
>client-side html frames. But due to popular demand, framse must go.
>
>Dave Ford
>Smart Soft - The Java Training Company
>http://www.smart-soft.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://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.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://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to