Re: Include Directive Misbehaving: Feedback for Mark Thomas

2006-11-11 Thread Mark Thomas
Justin Jaynes wrote:
 Mark Thomas,
 
 To start on a positive note, I 've never found an open source project with
 real help as accessable, as reliable, as knowledgeable, or as patient as I
 have with Tomcat.  I have access to amazing
 support/discussion groups, with immediate communications to developers and
 document writers.  It's better than any product I've ever paid for.

Thank-you on behalf of the entire community.

 The definition of a context there is VERY VAGUE.  And although it lists the 
 elements of a context, it gives NO EXAMPLES and no explanation of how to 
 create a context, and what a context does.  It says what a context is, but 
 not what it does.

The configuration documents are written assuming familiarity with a
number of concepts, contexts being one of them. Have you read
http://tomcat.apache.org/tomcat-5.5-doc/appdev/index.html ? It is
intended to provide an introduction to all of the basics, including
contexts.

I have read through the application developers guide and I can't see
any obvious gaps, but the gaps will be different for different people.
If you, or anyone else, has suggested changes, additions or
enhancements for the documentation I would be happy to look at them.

One thing I do want to add is a virtual hosting how-to.

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Justin,

Justin Jaynes wrote:
 You also suggested this: %@ include file=%= request.getContextPath() 
 %/header.jsp %
 I tried it but the code inside the quotes does not get evaluated.

Yeah, that was just an idea. I can't remember, does [EMAIL PROTECTED] %
require a context-relative path, or a server-relative path (meaning, you
should add the context path)? It occurs to me that an include is done on
the server-side, and is intended to be used within a webapp.

I also remember there was another way to import content from another
place. One of these directives actually compiles-in the content from the
other page (sort of like a JSP-include, where you can end up with one
big compiled JSP), and the other actually does an HTTP GET and includes
the resulting content in the output of the currently-executing JSP.

The former ought to be context-relative, meaning that you want
/header.jsp, while the latter might require a fully-qualified URI,
including the protocol and everything.

Does that help at all, or am I just wasting your time at this point? ;)

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUlTF9CaO5/Lv0PARAo/oAJ926rahrgg+HNi9dY26D0i6zJDycgCgkqq7
2fxafEjb7Mc5CLVlXuI+13U=
=TRxO
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive Misbehaving

2006-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Justin,

Justin Jaynes wrote:
 Oh snap!

I just love it when people use that phrase! You just brightened-up my
evening, Justin.

 That's exactly what's happening.

No wonder nothing makes sense. Glad you found your problem. Good luck.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUlVq9CaO5/Lv0PARAmUyAJ9LSqqex1pTgaRFdfb0F3FYTGdm8ACfZaza
YSKKVJbMPgMhVCGvhe+RsFQ=
=/dAs
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive Misbehaving: Feedback for Mark Thomas

2006-11-08 Thread Justin Jaynes
Mark Thomas,

To start on a positive note, I 've never found an open source project with
real help as accessable, as reliable, as knowledgeable, or as patient as I
have with Tomcat.  I have access to amazing
support/discussion groups, with immediate communications to developers and
document writers.  It's better than any product I've ever paid for.


I know you spend a LOT of time with end users.  Thanks a million.  You really 
make tomcat work for us.

With your pointers I've been able to glean the info I needed and I've fixed my 
problem.

I don't think there is any wrong info on the doc pages.  But either I am not 
seeing everything there is to read, or there is a lack of explanation about 
contexts.  I mean, really, I've been using tomcat for a few years and I learned 
the whole thing alone.  Just me, a book, tomcat, and this list (I guess that's 
not really alone).  And frankly, there is no reasonable explanation of what a 
context is.  I feel like the documentation might be assuming I know more than I 
do.  Me and anybody else who has very few resources to become introduced to 
tomcat.

Where am I looking on the site?  Well, I go to the tomcat page and click 
Configuration in the Reference section of links.  I click on Context under the 
Containters section of links.

The definition of a context there is VERY VAGUE.  And although it lists the 
elements of a context, it gives NO EXAMPLES and no explanation of how to create 
a context, and what a context does.  It says what a context is, but not what it 
does.

Please consider revising the context page to make it clearer.  If I had a 
firmer understanding, I would volunteer a revision myself.

Justin



- Original Message 
From: Mark Thomas [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, November 7, 2006 10:27:38 PM
Subject: Re: Include Directive Misbehaving

Justin Jaynes wrote:
 Oh snap!  That's exactly what's happening.  Can you point me to a good 
 document that expalins how to set up contexts?  I've got everything set up 
 exactly as you described.

 Any good reading for a comprehensive (or even rudimetry) understanding would 
 be greatly appreciated.
The on-line docs should have what you need. If we can id places where
changes are needed then I'll get them incorporated.

 If you can explain it in a reasonable length that is appropriate to this 
 forum (and convenient to your time), it would also be greatly appreciated.
The short version is:
- a context's docBase should never be the same as a host's appBase

A suitable directory structure for multiple hosts could be:
$CATALINA_HOME\host1-webapps  - Host1 appBase
$CATALINA_HOME\host1-webapps\ROOT - Default context for Host1
$CATALINA_HOME\host1-webapps\app1 - Application on Host1
$CATALINA_HOME\host1-webapps\app2 - Application on Host1
$CATALINA_HOME\host2-webapps  - Host2 appBase
$CATALINA_HOME\host2-webapps\ROOT - Default context for Host2
$CATALINA_HOME\host2-webapps\app3 - Application on Host2
etc for as many hosts and applications as you like

 The explanation in the doc on the tomcat.apache.org site seems to only cover 
 what I am using, which treats every director as a webapp.  Definatly not what 
 I want.
Which page(s) are you looking at? If the docs tell you to do this they
need to be changed. I can't see anything like this but I could easily
be missing the obvious.

Mark


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive

2006-11-07 Thread Juanjo Cuadrado

Hi,

  Can you try the follow:

%@ include file=*/header.jsp* %

   I think that this will work fine.

2006/11/7, Justin Jaynes [EMAIL PROTECTED]:


Hello,

I am trying to eliminate unnecessary duplication of code by using include
directives.  Currently my directory structure is like this:

[main app directory]
index.jsp
header.jsp
footer.jsp
[admin subdirectory]
index.jsp

The index.jsp file in the main directory contains the code %@ include
file=header.jsp % and it works great.

In the admin directory the index.jsp file contains this code %@ include
file=../header.jsp % obviously referencing to the parent directory, where
the header.jsp file sits.  I don't want to have to copy it to the child
directory and maintain two copies of it.

But when I do this, I get an error every time.  What am I doing
wrong?  You can find the error below.

Justin

HTTP Status 500 - type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: /index.jsp(4,0) File /../header.jsp
not found
   org.apache.jasper.servlet.JspServletWrapper.handleJspException(
JspServletWrapper.java:512)
   org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:377)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:314)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: /index.jsp(4,0) File /../header.jsp
not found
   org.apache.jasper.compiler.DefaultErrorHandler.jspError(
DefaultErrorHandler.java:39)
   org.apache.jasper.compiler.ErrorDispatcher.dispatch(
ErrorDispatcher.java:405)
   org.apache.jasper.compiler.ErrorDispatcher.jspError(
ErrorDispatcher.java:86)
   org.apache.jasper.compiler.Parser.processIncludeDirective(
Parser.java:339)
   org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java
:372)
   org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
   org.apache.jasper.compiler.Parser.parseElements(Parser.java:1556)
   org.apache.jasper.compiler.Parser.parse(Parser.java:126)
   org.apache.jasper.compiler.ParserController.doParse(
ParserController.java:211)
   org.apache.jasper.compiler.ParserController.parse(
ParserController.java:100)
   org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
   org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
   org.apache.jasper.JspCompilationContext.compile(
JspCompilationContext.java:563)
   org.apache.jasper.servlet.JspServletWrapper.service(
JspServletWrapper.java:305)
   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
:314)
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Include Directive

2006-11-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Justin,

 The index.jsp file in the main directory contains the code %@
 include file=header.jsp % and it works great.
 
 In the admin directory the index.jsp file contains this code %@
 include file=../header.jsp % obviously referencing to the parent
 directory, where the header.jsp file sits.  I don't want to have to
 copy it to the child directory and maintain two copies of it.
 
 But when I do this, I get an error every time.  What am I doing
 wrong?  You can find the error below.

It's a good idea to start your include directives with a '/', making
your paths relative to the context path (the webapp base URI, if you
will). As you can see, Tomcat is adding a leading '/' for you, which
makes the path into nonsense:

 File /../header.jsp not found

/../header.jsp would actually be located one directory above your
webapp's root directory, which is illegal.

Consider using /header.jsp as the include's location.

There is another thread from the last 24 hours or so with someone asking
about changing context paths. This is the best way to do this:

%@ include file=%= request.getContextPath() %/header.jsp %

Not sure if that compiles (I haven't touched JSP in years), but it's the
general idea.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUIbR9CaO5/Lv0PARAiNSAJ9T4mX3Vz5nMvdNN/RfyS25CmpKVQCdENMF
f09sh+IY0kXEb/MPD39Qi+Y=
=44Mk
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive

2006-11-07 Thread Dies Koper

Hello Chris, Justin,


The index.jsp file in the main directory contains the code %@
include file=header.jsp % and it works great.

In the admin directory the index.jsp file contains this code %@
include file=../header.jsp % obviously referencing to the parent
directory, where the header.jsp file sits.  I don't want to have to
copy it to the child directory and maintain two copies of it.

But when I do this, I get an error every time.  What am I doing
wrong?  You can find the error below.


It's a good idea to start your include directives with a '/', making
your paths relative to the context path (the webapp base URI, if you
will). As you can see, Tomcat is adding a leading '/' for you, which
makes the path into nonsense:


The JSP2.0 spec says that both context-relative paths and page relative 
paths area allowed. Both are as described in RFC 2396 meaning that 
../ is allowed too. For page relative paths, it is prepended by the 
path of the JSP or tag that it is used in (relative to the context path) 
so that the path eventually starts with a '/'.

#Section JSP1.2.1

While I agree it is better to use a context-relative path to make it 
easier later to move the page around, I don't see why it wouldn't work 
with ../header.jsp..



There is another thread from the last 24 hours or so with someone asking
about changing context paths. This is the best way to do this:

%@ include file=%= request.getContextPath() %/header.jsp %

Not sure if that compiles (I haven't touched JSP in years), but it's the
general idea.


No, this is a directive to the JSP translator so no Java code in it is 
executed.


Regards,
Dies


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive

2006-11-07 Thread Justin Jaynes
Chris,

Using /header.jsp which is of course an absolute path, I get virtually the 
same error.  Only /../header.jsp changes to /header.jsp  Still doesn't work.

You also suggested this: %@ include file=%= request.getContextPath() 
%/header.jsp %
I tried it but the code inside the quotes does not get evaluated.

Justin

- Original Message 
From: Christopher Schultz [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, November 7, 2006 6:14:58 AM
Subject: Re: Include Directive

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Justin,

 The index.jsp file in the main directory contains the code %@
 include file=header.jsp % and it works great.
 
 In the admin directory the index.jsp file contains this code %@
 include file=../header.jsp % obviously referencing to the parent
 directory, where the header.jsp file sits.  I don't want to have to
 copy it to the child directory and maintain two copies of it.
 
 But when I do this, I get an error every time.  What am I doing
 wrong?  You can find the error below.

It's a good idea to start your include directives with a '/', making
your paths relative to the context path (the webapp base URI, if you
will). As you can see, Tomcat is adding a leading '/' for you, which
makes the path into nonsense:

 File /../header.jsp not found

/../header.jsp would actually be located one directory above your
webapp's root directory, which is illegal.

Consider using /header.jsp as the include's location.

There is another thread from the last 24 hours or so with someone asking
about changing context paths. This is the best way to do this:

%@ include file=%= request.getContextPath() %/header.jsp %

Not sure if that compiles (I haven't touched JSP in years), but it's the
general idea.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUIbR9CaO5/Lv0PARAiNSAJ9T4mX3Vz5nMvdNN/RfyS25CmpKVQCdENMF
f09sh+IY0kXEb/MPD39Qi+Y=
=44Mk
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Include Directive Misbehaving

2006-11-07 Thread Justin Jaynes
To further complicate this problem, I have tried more experimenting and am 
becoming more frustrated.

The original situation remains below.

Now if I add a sub-directory to the admin subdirectoy, the directory structure 
looks like this:

[main host directory (/host)]
index.jsp
header.jsp (ROOT VERSION, with a notation I can see in the html distinguishable 
from others)
[admin sub directory (/host/admin)
index.jsp
header.jsp (ADMIN VERSION, with a notation)
[user sub directory (/host/admin/user)]
[justin sub directory (/host/admin/user/justin)]
index.jsp

As you can see, I have copied the header.jsp to the sub-directory admin and 
have altered its contets so I can identify which header.jsp is being 
used--namely that in the root directory or in the admin directory.

Then in the index.jsp file in the justin subdirectory, I use the code

%@ include file=../../../header.jsp %

to reach the ROOT header.jsp to be included.  But instead, the output in the 
browser uses the file from the ADMIN directory.

So I figured I should just add ../ once more to move one more level up.  so I 
did.

%@ include file=../../../../header.jsp %

But it used the ADMIN version again.

%@ include file=../../../../../../../../header.jsp %

actually does too.  What is the problem here?

And trying to go less instead of more,

%@ include file=../../header.jsp %

this also works but uses the ADMIN version.  Which is the expected behavior FOR 
ONCE.

But then even less

%@ include file=../header.jsp %

gives this error:

org.apache.jasper.JasperException: /sites/14/index.jsp(8,0) File 
/sites/14/../header.jsp not found

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Can someone try to reproduce this error?  I believe that Tomcat 5.5 and 6.0 do 
not behave properly in this reguard.  Unless I am making a mistake.  If that is 
the case, please guide me out of it.

Justin

When I enter the same 

- Original Message 
From: Justin Jaynes [EMAIL PROTECTED]
To: users@tomcat.apache.org
Sent: Monday, November 6, 2006 10:01:00 PM
Subject: Include Directive

Hello,

I am trying to eliminate unnecessary duplication of code by using include 
directives.  Currently my directory structure is like this:

[main app directory]
index.jsp
header.jsp
footer.jsp
[admin subdirectory]
index.jsp

The index.jsp file in the main directory contains the code %@ include 
file=header.jsp % and it works great.

In the admin directory the index.jsp file contains this code %@ include 
file=../header.jsp % obviously referencing to the parent directory, where 
the header.jsp file sits.  I don't want to have to copy it to the child 
directory and maintain two copies of it.

But when I do this, I get an error every time.  What am I doing wrong?  You can 
find the error below.

Justin

HTTP Status 500 - type Exception report
message 
description The server encountered an internal error () that prevented it from 
fulfilling this request.
exception 
org.apache.jasper.JasperException: /index.jsp(4,0) File /../header.jsp not 
found

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause 
org.apache.jasper.JasperException: /index.jsp(4,0) File /../header.jsp not 
found

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)

org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:339)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:372)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1556)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)

org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)

org.apache.jasper.JspCompilationContext.compile

Re: Include Directive Misbehaving

2006-11-07 Thread Mark Thomas
Justin Jaynes wrote:
 To further complicate this problem, I have tried more experimenting and am 
 becoming more frustrated.

I have just tested all combinations of files and included files for
three levels of directories and everything is working as it should.

Just a guess but...
Is it possible your contexts are not correctly deployed? If your
host's appBase and your web application's docBase point to the same
directory and autoDeploy is enabled you will have all sorts of odd
behaviour since by default *every* directory in a host's appBase gets
deployed as a web application.

HTH,

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive Misbehaving

2006-11-07 Thread Justin Jaynes
Oh snap!  That's exactly what's happening.  Can you point me to a good document 
that expalins how to set up contexts?  I've got everything set up exactly as 
you described.

Any good reading for a comprehensive (or even rudimetry) understanding would be 
greatly appreciated.

If you can explain it in a reasonable length that is appropriate to this forum 
(and convenient to your time), it would also be greatly appreciated.

The explanation in the doc on the tomcat.apache.org site seems to only cover 
what I am using, which treats every director as a webapp.  Definatly not what I 
want.

Justin

- Original Message 
From: Mark Thomas [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, November 7, 2006 9:30:07 PM
Subject: Re: Include Directive Misbehaving

Justin Jaynes wrote:
 To further complicate this problem, I have tried more experimenting and am 
 becoming more frustrated.

I have just tested all combinations of files and included files for
three levels of directories and everything is working as it should.

Just a guess but...
Is it possible your contexts are not correctly deployed? If your
host's appBase and your web application's docBase point to the same
directory and autoDeploy is enabled you will have all sorts of odd
behaviour since by default *every* directory in a host's appBase gets
deployed as a web application.

HTH,

Mark

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive

2006-11-07 Thread Layton Berry

Using Tomcat 5.5.20, I'm having no trouble with relative paths such as:

%@ include file=../filename.inc %

... and we have several of them.  So your original usage looks correct. 
 I would say to be sure you didn't put the wrong index.jsp file in the 
main app directory.


We do not use a leading slash, since that would mean it is not a 
relative path.  Clearly, /../filename.jsp is not going to work.


We do not use the .jsp extension for include files because 
pre-compiling would try to compile the include files, and Tomcat will 
also try to compile them if you try to access them.


Layton

Justin Jaynes wrote:

Chris,

Using /header.jsp which is of course an absolute path, I get virtually the 
same error.  Only /../header.jsp changes to /header.jsp  Still doesn't work.

You also suggested this: %@ include file=%= request.getContextPath() 
%/header.jsp %
I tried it but the code inside the quotes does not get evaluated.

Justin

- Original Message 
From: Christopher Schultz [EMAIL PROTECTED]
To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, November 7, 2006 6:14:58 AM
Subject: Re: Include Directive

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Justin,


The index.jsp file in the main directory contains the code %@
include file=header.jsp % and it works great.

In the admin directory the index.jsp file contains this code %@
include file=../header.jsp % obviously referencing to the parent
directory, where the header.jsp file sits.  I don't want to have to
copy it to the child directory and maintain two copies of it.

But when I do this, I get an error every time.  What am I doing
wrong?  You can find the error below.


It's a good idea to start your include directives with a '/', making
your paths relative to the context path (the webapp base URI, if you
will). As you can see, Tomcat is adding a leading '/' for you, which
makes the path into nonsense:


File /../header.jsp not found


/../header.jsp would actually be located one directory above your
webapp's root directory, which is illegal.

Consider using /header.jsp as the include's location.

There is another thread from the last 24 hours or so with someone asking
about changing context paths. This is the best way to do this:

%@ include file=%= request.getContextPath() %/header.jsp %

Not sure if that compiles (I haven't touched JSP in years), but it's the
general idea.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUIbR9CaO5/Lv0PARAiNSAJ9T4mX3Vz5nMvdNN/RfyS25CmpKVQCdENMF
f09sh+IY0kXEb/MPD39Qi+Y=
=44Mk
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Include Directive Misbehaving

2006-11-07 Thread Mark Thomas
Justin Jaynes wrote:
 Oh snap!  That's exactly what's happening.  Can you point me to a good 
 document that expalins how to set up contexts?  I've got everything set up 
 exactly as you described.

 Any good reading for a comprehensive (or even rudimetry) understanding would 
 be greatly appreciated.
The on-line docs should have what you need. If we can id places where
changes are needed then I'll get them incorporated.

 If you can explain it in a reasonable length that is appropriate to this 
 forum (and convenient to your time), it would also be greatly appreciated.
The short version is:
- a context's docBase should never be the same as a host's appBase

A suitable directory structure for multiple hosts could be:
$CATALINA_HOME\host1-webapps  - Host1 appBase
$CATALINA_HOME\host1-webapps\ROOT - Default context for Host1
$CATALINA_HOME\host1-webapps\app1 - Application on Host1
$CATALINA_HOME\host1-webapps\app2 - Application on Host1
$CATALINA_HOME\host2-webapps  - Host2 appBase
$CATALINA_HOME\host2-webapps\ROOT - Default context for Host2
$CATALINA_HOME\host2-webapps\app3 - Application on Host2
etc for as many hosts and applications as you like

 The explanation in the doc on the tomcat.apache.org site seems to only cover 
 what I am using, which treats every director as a webapp.  Definatly not what 
 I want.
Which page(s) are you looking at? If the docs tell you to do this they
need to be changed. I can't see anything like this but I could easily
be missing the obvious.

Mark


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Include Directive

2006-11-06 Thread Justin Jaynes
Hello,

I am trying to eliminate unnecessary duplication of code by using include 
directives.  Currently my directory structure is like this:

[main app directory]
index.jsp
header.jsp
footer.jsp
[admin subdirectory]
index.jsp

The index.jsp file in the main directory contains the code %@ include 
file=header.jsp % and it works great.

In the admin directory the index.jsp file contains this code %@ include 
file=../header.jsp % obviously referencing to the parent directory, where 
the header.jsp file sits.  I don't want to have to copy it to the child 
directory and maintain two copies of it.

But when I do this, I get an error every time.  What am I doing wrong?  You can 
find the error below.

Justin

HTTP Status 500 - type Exception report
message 
description The server encountered an internal error () that prevented it from 
fulfilling this request.
exception 
org.apache.jasper.JasperException: /index.jsp(4,0) File /../header.jsp not 
found

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause 
org.apache.jasper.JasperException: /index.jsp(4,0) File /../header.jsp not 
found

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)

org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)

org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)

org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:339)
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:372)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1556)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)

org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)

org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



problem related include directive action

2006-05-22 Thread Harshal Joshi




Hi,

I want to know exact 
difference between include directive  include action. As I have 
readfrom some sites  some books
that one diff. is 
Include directive is take place at translation (compile) time while action takes 
place as runtime.
So, if you make 
change in included file, that change will only reflect by include 
actionjsp:action page="..."/
But Idid one 
example which show me changes in both include directive as well as include 
action.
I did testing on 
tomcat 4.1  tomcat 5.0.28. So can any onetell me exact diff. 
b/w include directive  action.

As all r saying abt 
changes don't reflect by include directive then why I see changes in my 
example?

Plz clarify if I am 
wrong at some place... Thanks for your help...

Example...

file 
checkInclude.jsp
bInclude Directive content :: 
/b %@ include file="included.jsp" 
%brbr
bInclude Action content :: /b 
jsp:include page="included.jsp" /

file 
included.jsp
%@ page language="java" import="java.util.Date" 
%
bDate is ::/b%= new 
Date()%

Result is 
::
Include Directive content :: Date is 
:: Mon May 22 13:14:40 GMT+05:30 2006 Include Action content 
:: Date is :: Mon May 22 13:14:40 GMT+05:30 2006

Update 
included.jsp 

%@ page language="java" import="java.util.Date" 
%
bToday's Date is 
::/b%= new Date()%

Result after 
update ::
Include Directive content :: Today's 
Date is :: Mon May 22 13:17:04 GMT+05:30 2006 Include Action 
content :: Today's Date is :: Mon May 22 13:17:05 GMT+05:30 
2006









Thanks 
 Regards,
Harshal 
Joshi
Software 
Engineer



Re: problem related include directive action

2006-05-22 Thread Mark Thomas
Harshal Joshi wrote:
 I want to know exact difference between include directive  include
 action.

The JSP spec is your friend.

http://java.sun.com/products/jsp/reference/api/index.html

Mark

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JSP Include directive problem when upgrading to Tomcat 5.5

2006-04-10 Thread TiGRETON
Hi,

We are moving from Tomcat 5.0.28 to Tomcat 5.5.16, and we found that JSP
%@ include % directives fail when the path contains a call to a file
placed in the parent (..) directory.

AFAIK Tomcat is creating a separate context for JSP files in the /admin/
directory. How can I disable this behavior?

This is our server.xml file. We replaced the original one with this
trimmed version. We only use AJP (which works fine), and as we have
several tomcats running on the same server we changed the port numbers

-
--[server.xml]
Server port=46007 shutdown=SHUTDOWN

  Service name=Catalina-Service-DG-46006

Connector address=127.0.0.1 allowTrace=false
  enableLookups=false maxPostSize=2097152
  scheme=http secure=false port=46006 protocol=AJP/1.3 /

Engine name=Catalina-Engine-DG-46006 defaultHost=localhost

  Host name=localhost
appBase=/var/www/html/oursite.com autoDeploy=false
Aliaswww.oursite.com/Alias
Aliasoursite.com/Alias

Context path=/ docBase= cookies=true /

  /Host
/Engine
  /Service
/Server
- 

- --[/var/www/html/oursite.com/foo.jsp]---
% out.write(h2foo/h2); %
- 

- --[/var/www/html/oursite.com/admin/bar.jsp]-
% out.write(h1Bar/h1); %
%@ include file=../foo.jsp %
- 

- --[Error when calling oursite.com/admin/bar.jsp]
org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /bar.jsp(2,0) File /../foo.jsp not
found
- 

Thanks!

Iván Montoro

P.S. Sorry if this is covered in any FAQ, but I've searched the mailing
list archives, google'd and read the Tomcat docs without clue...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]