I experience the same behaviour

Basically I have the following code at the top of each JSP

String contextPath = request.getContextPath();

For each resource on the page i append the subdirectory and resource name to
the contextPath. I am wondering if there is a better way.

eg a javascript include may look like

<script language="JScript"
src="<%=contextPath%>/script/xmlScripts.jsp"></script>

I too wonder if there is a better way to do this.

As far as forwarding goes - I dont use the context path either. Orion (and
all other servlet containers like Tomcat, JavaWebserver) seems to somehow
already know what the context is and things wont work if you start prefixing
things with the context when doing forwards or includes.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Duffey
Sent: Monday, 19 June 2000 12:12
To: Orion-Interest
Cc: Orion-Interest
Subject: Multiple web-apps sharing some dir


Hi,

I have been able to set up 3 apps, /radio, /tv and /cable in the config
files. All 3 point to the same one dir (/app/www) because the pages are
identical for all three..the only difference being the media name. I want
each to have its own servlet context, no sharing. So far, everything is fine
except for one problem. In all my links, it appears I have to give the
context name for the site to work. Since all 3 apps use the same one dir, I
am forced to code every link with a dynamic variable that takes on the name
of the context. This isn't a problem..as much as I am wondering if this is
correct or not? Am I supposed to use /radio, /tv or /cable before EVERY
link, including in my code? Oh yeah..I did come across one problem. In my
code, it went to forward to a page, and I added the context before the
page..and the server said it couldn't find /radio/xxx.jsp. So, if you
forward from inside a servlet to another jsp page, are you supposed to use
the servlet context path in the code as well?

Ideally, it would be great if all links could just be /path/<page_name>.jsp
and it automatically figures out the context from the request coming in. I
take it the session ID is only for the session, and doesn't keep track of
the context the session exists in?

Thanks.



Reply via email to