Mr Farquhar,

You must always use rcp (or <%= request.getContextPath() %>) in front of
every path to make your web app fully portable. It may be tedious but
there's no other way around it besides making every path relative (which is
sometimes not possible with include files etc)

In stylesheets and JS files, use relative paths, this is the only way I can
see to do this effectively. It shouldn't be too much of a problem though.

<%@ include %> and <jsp:include> are always relative to the web app root.

NOTE: All JSP commands are relative to the web app root EXCEPT
response.sendRedirect() which is relative to the host (stupid spec bug!) so
you need to put an rcp in front of that.

-mike

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of SCOTT FARQUHAR
> Sent: Friday, March 16, 2001 10:17 AM
> To: Orion-Interest
> Subject: offtopic: Path issues
>
>
> When I have multiple web applications running on the one server -
> I'm having problems referencing files in other directories.
>
> eg - I can't use "/images/anImage.gif" because that references
> the document root.  I can use "<%= request.getContextPath()
> %>/images/anImage.gif" ,but that gets tedious.  Is there a better
> way to do it?
>
> The other problem I have is referencing images from stylesheets
> and javascript files.  Because they don't go through the JSP
> processor, I can't use request.getContextPath() .  Without
> mapping .css and .js to the jsp servlet - is there a way around this?
>
> Also - with include files - are they always rooted from the web context
>
> ie <@ include file="/includes/pageheader.jsp" %> —--> does this
> map to  http://myserver.com/mywebapp/includes/pageheader.jsp   ?
>
> Does the same go for <jsp:include page="/includes/pageheader.jsp" />  ?
>
> Thanks in advance for any help.
>
> Scott
>
>
>


Reply via email to