I'm working on a large website and would like it to have a navigation bar,
etc. at the top and an additional (probably context-sensitive) navigation
area on the left side. This would be an ideal use for frames because the
navigation stuff would only be loaded from the server as often as necessary
(saving time for the user and load on the server) and also the content
html(.jsp) document can be edited independent of the relatively static
navigation/border stuff. Here's an ascii picture (which, depending on your
font, is probably going to look pretty mangled) of the layout I'm talking
about.
---------------------------
| Nav1 |
---------------------------
| N | |
| a | |
| v | Content |
| 2 | |
| | |
---------------------------
I would like the user to be able to bookmark any content page and be able to
come back to it later. This doesn't work very well with frames because only
the URL of the initial document (IIRC, the frameset) gets stored by the
Netscape browser. I believe IE will remember the current URL of each frame
in its bookmark but I want Netscape users to be able to bookmark. Sooo....
it looks like we're going to go with a frames-emulated-via-tables approach.
Each request the user makes is going to result in the whole composite page
being served (e.g. "nav1.html" + "nav2.html" + "contentX.html"). I've heard
FrontPage has something called "Shared Borders" that's similar. My
question is what's the best way to accomplish this with Servlets/JSP's?
The approaches I can think of off the top of my head are :
1. Each contentX.html contains the navigation stuff in it. PROBLEM : Not
maintanable at all. If a change is made in Nav1 every contentX.html/.jsp
must have the change duplicated.
2. Create a "Border.jsp" that contains everything except the content pane.
Where the content would go is a JSP tag to dynamically include a jsp or html
(possibly via a request parameter that specifies the content filename). The
content pane include tag would presumably be contained within a table cell
(since we're trying to emulate frame-style layout). PROBLEM : The content
document is no longer a valid HTML document (since the
<HTML><TITLE>title</TITLE><BODY>...</BODY></HTML> is contained in the border
document) which makes it a little harder to edit/maintain. Also, the
content document might require a specific title but the title tag is in the
border document.
3. Each content file would be a complete HTML document and would have
something like <jsp:include page = "StandardHeader.jsp"> right after the
<BODY> tag and <jsp:include page="StandardFooter.jsp(or html)"> right
before the </BODY> tag. Something about this seems a little hokey but
maybe it's the right solution. I don't really want the server to actually
open and read the "StandardHeader.jsp/html" file for every request. It
would be nice if this ended up statically compiled into the JSP servlet (is
that possible?).
Have any of you found an approach that works well? I'm leaning towards #3
but thought I might be overlooking another possible alternative.
As an aside, I've noticed that almost none of the major sites (Amazon,
ETrade, etc.) use frames. Am I right in assuming this is due more to
bookmarking and navigational/logic issues than to browser non-support (since
most users are using frames-capable browsers)?
Thanks in advance for any comments/suggestions!
Brien Voorhees
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html