tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juha Laiho <Juha.La...@iki.fi>
Subject Re: Why cant I access a folder at root level which contains Java Script
Date Tue, 06 Apr 2010 17:26:35 GMT
On 04/03/2010 11:57 PM, nzindian wrote:
> Im trying to use a javascript WYSIWYG editor in a JSP page.
>
> The JSP is in the following directory:
> apache-tomcat-5.5.28/webapps/SimpleBlog
>
> The Java script is in this directory:
> apache-tomcat-5.5.28/webapps/SimpleBlog/js
>
> The JSP contains the following code to include the JS file:
> <script language="JavaScript" type="text/javascript"
> src="js/scripts/wysiwyg.js"></script>
> <script language="JavaScript" type="text/javascript"
> src="js/scripts/wysiwyg-settings.js"></script>
>
> and it doesnt work,

... because if that's really how you have things set up, the paths
to the scripts should not have the /scripts/ level, but instead they
should be:

<script language="JavaScript" type="text/javascript" 
src="js/wysiwyg.js"></script>
<script language="JavaScript" type="text/javascript" 
src="js/wysiwyg-settings.js"></script>

> Ive also tried adding a backslash before the js in the "src=".
>
> However if I copy the JSP into the js folder (and remove the "js" from the
> "src=") then it works!
>
> Why can the JSP see the "js" folder?

As others have said, it's the browser which either sees or doesn't see
something. If you're using Firefox, you could use one of the many
extensions to find out what the browser actually requests, and what
is the request from the server. My preferred FF extension for this
would be TamperData. If you have access log enabled on your server,
the requested resource path along with the HTTP response code set by
the server will also be visible there.

Remember that the browsers always request with absolute paths; relative
paths are an HTML feature, but requests are done with HTTP, which only
recognizes absolute paths. Thus, the browser will create the absolute
paths based on location of the referring resource and the relative
reference. As always with relative references, you have to pay close
attention to the context.
-- 
..Juha

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message