...
>So for example if my main file is in a folder "cart" and I want to access
>the header file contained in the folder "include" then I can't.
Where is 'cart'? What is the actual path from the root?
>I have tried the following but it won't work <%@ include
>file="../include/amt_header.jsp" %>.
Given a leading '/' indicates 'from the root of the site',
if that first string ever worked, then this should also work
(from anywhere within the site).
<%@ include file="/include/amt_header.jsp" %>

Signature
Andrew Thompson
http://www.athompson.info/andrew/
KevinRobinson - 25 Apr 2007 15:22 GMT
If I use <%@ include file="/include/amt_header.jsp" %>
File "/include/amt_header.jsp" not found.
> ..
>>So for example if my main file is in a folder "cart" and I want to access
[quoted text clipped - 9 lines]
> (from anywhere within the site).
> <%@ include file="/include/amt_header.jsp" %>
Wojtek - 25 Apr 2007 15:58 GMT
KevinRobinson wrote :
> If I use <%@ include file="/include/amt_header.jsp" %>
>
> File "/include/amt_header.jsp" not found.
This is because the file include is dependant on the OS file system. So
if you are using windows and the JSP pages are on drive X:, then the
above statement will look for the file in X:\include.
You must either place the fully qualified path in the include (highly
not portable, as your development environment paths most likely do not
match your test and production paths, or use relative paths.
Count the directories. I have include directives which are several
layers deep:
<%@ include file="../../../_include/_setup.jspf" %>

Signature
Wojtek :-)
David P - 25 Apr 2007 18:23 GMT
test
Lew - 25 Apr 2007 23:52 GMT
> test
Your test failed.
Miserably.

Signature
Lew
Andrew Thompson - 26 Apr 2007 02:22 GMT
David P wrote:
>> test
>
>Your test failed.
>
>Miserably.
Note that the alt.test.* groups are wonderful for this purpose.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Thanks,
the ../ worked eventually.
Just one other related question.
If the header.jsp (in the include folder) contains for example <a
href="/email/join_email_list.jsp"> and if
the jsp that I want to use the header in is in the same directory as the
include folder
then I use <%@ include file="/include/amt_header.jsp" %>.
If the jsp that I want to use the header in is in one folder down then I
use:-
<%@ include file="../include/amt_header.jsp" %>.
If I use a jsp with the header in a different folder say 'cart' and I use
<%@ include file="../include/amt_header.jsp" %> then it works with
hrefs pointing to the root but the <a href="/email/join_email_list.jsp"> no
longer works.
Is there a way round this without having to have 2 header files the second
containing <a href="../email/join_email_list.jsp">
Thanks
> Hi,
>
[quoted text clipped - 23 lines]
>
> Kevin
Wojtek - 26 Apr 2007 14:10 GMT
KevinRobinson wrote :
> Thanks,
>
[quoted text clipped - 19 lines]
> Is there a way round this without having to have 2 header files the second
> containing <a href="../email/join_email_list.jsp">
You are mixing up URL paths with OS paths.
In a URL the / means start from the web server root.
In an OS path the / (or \) means start from the drive root.
So your includes would take into consideration where they are in your
path structure, whereas your URLs always use the same text.
The URL <a href="/email/join_email_list.jsp"> will always be the same
regardless of which page it is in.

Signature
Wojtek :-)
jacma983@yahoo.fr - 28 Apr 2007 03:09 GMT
On Apr 26, 12:19 pm, "KevinRobinson" <k.s.robin...@btinternet.com>
wrote:
> Thanks,
>
[quoted text clipped - 19 lines]
> Is there a way round this without having to have 2 header files the second
> containing <a href="../email/join_email_list.jsp">
As wotjek told you, you are confusing two unrelated things:
- the <a href="../..."> shall be resolved by the Web browser of the
user visiting the site if/when it clicks on the link.
- the 'include' is resolved by your servlet container (e.g. Tomcat)
when it will process your .jsp file
Relatives "includes" (i.e. those not starting with a '/') are always
relative to the directory of the .jsp file they appear in.