Dave,

You can also consider encapsulating your menu functionality and attributes
in pure JS files.  Then, on a JSP file that you can call "FirstPage", you
include both your JS menu file, and your standard header at the top.  Play
around with where you want the menu and header positioned on
"FirstPage.jsp".  Then all your other JSP's can use the "JSP include" tag,
to include your FirstPage.jsp.  This will give a standard look and feel to
your web site.

The current web site I am designing has a requirement for using menu's
without frame sets, but the menu's will be different based on the security
level assigned to the user's login password.  I borrowed the menu concept
from HierMenu central's Dynamic HTML lab, which has an EXCELLENT set of
shareware JS menu code that works in ALL browsers.  You can change the
menu's attributes from "a top loading" to "a side loading" menu with just a
property change.  You can find this code at
http://www.webreference.com/dhtml/column52/.  In my case, I had to modify
their concept to allow me to load different menu's based on a user's
security level, and I did this via an XML file that associates a different
JS file to a given security level, which in turn contains that user's menu
attributes.

By the way, if your wondering why I did this in an XML file and NOT in the
database, the requirement via the customer was NOT to allow the user to
establish a connection to the db, until they had "passed" a "first level
security" screen.  The first level security screen is contained in an XML
file.  Once the user passes the first level security screen, the user is
then allowed to establish a connection to the db, which in turn runs a
second level security screen (which MUST be different from the first level
test) before the user can proceed to his "first page", which in turn
contains the "security specific" menu.  Never work on a government contract
UNLESS you enjoy having your brain twisted by bizarre requirements and high
level mathematical algorithms.

Celeste

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Dave Ford
Sent: Thursday, May 10, 2001 2:17 PM
To: [EMAIL PROTECTED]
Subject: Standar Template


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

===========================================================================
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