"Duffey, Kevin" wrote:
>
> Hi all,
>
> I am including a header and footer on every page to give a consistent top
> and bottom menu look. I use compile-time includes instead of run-time. I
> prefer a bit bigger servlet with a little more performance than the runtime
> chaining from one servlet to the next, plus the compile-time makes sure any
> variables I declare in one include (or above it) are usable throughout the
> entire page.
>
> Anyways, I am deploying using two (or more) web-apps in one container. I use
> a contextPath to indicate where a resource is, so I want to do something
> like this:
>
> <%
> String contextPath = request.getContextPath();
> %>
>
> <%@ include file="<%= contextPath %>/path/header.inc" %>
>
> stuff..
>
> <%@ include file="<%= contextPath %>/path/footer.inc" %>
>
> Is this possible to include a dynamic variable? I get errors right now, so
> the question is, is there any way to do this?
A path that starts with a slash in the file attribute is interpreted
as context-relative by the container; no need to add the context
path yourself.
Considering how many questions you have had about paths lately, I really
recommend that you read the section about path interpretation
in Chapter 12 of my book:
<http://TheJSPBook.com/>
Hans
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.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