Heh..I have had a lot heh. The main reason is we are deploying our site as 2
apps, and I have had a number of things not work right. For example, I
deploy a site as / (root) for the outside, and /inside for the inside site.
JSP pages located in the /inside site use the /images/ type of path and are
pulling images from the root web app. There is possibly one explanation I
can think of why it does this. My dir structure. I currently have:
/app/www - root outside site
/app/www/images - images folder for outside site
/app/www/inside - root inside site
/app/www/inside/images - inside site images.
I think that for what ever reason, in a JSP page in the inside site when it
has the / at the start of the path, it assumes the outside sites path, since
it is deployed at /. I assume if I had /app/outside, and /app/inside, this
problem would go away. The only reason I have kept this structure is to make
it simple in source safe to have a single WWW folder for all of our www
related web-apps. We have /src, /www, and /properties and /lib in VSS. I
simply map the /www to my /app/www, and map the /www/inside in VSS to the
/app/www/inside of my local file system. Again, I did it this way to
simplify the folder layout structure when developing. When deploying to
production sites I plan to WAR up the / and /inside as separate war files,
which may end up eliminate the need to use <%= contextPath %>/ on EVERY
single link, href, action and image tags.
See what I am getting at? So let me ask you this..what I just described
above, is it possible that a jsp page on the inside app is accessing the
root (outside) web-apps images folder simply because of the dir structure I
am using? Normally, the src="/images/image.gif" in the inside JSP pages
should indeed be relative to the /inside deployed web-app, but as I said,
for some reason, they consistently grab the /images folder from the outside
site. Its almost as if I need to use /inside/images/image.gif, which is what
the <%= contextPath %> yields for me.
I'll take a look at your book too.
> -----Original Message-----
> From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 2:58 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Possible to add dynamic string in an include directive?
>
>
> "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
>
===========================================================================
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