Dear List,
I'm writing you hoping to get some insight on a problem that's been haunting
me for quite a while now. I've tried searching the ML archives but I have
not come up with anything useful.

I have a Struts-based web application which makes use of the Tiles framework
and of some dynamic Javascript libraries (such as OpenLayers, for example,
but I think this issue applies to pretty much any JS file). In a "normal"
JSP page I just included the script file, e.g.:

<script language="Javascript" src="/scripts/OpenLayers/OpenLayers.js"/>

which means:

"load for the Javascript file located at
<address>/scripts/OpenLayers/OpenLayers.js"

and everything would work fine. But putting the very same statement in the
jsp tile of the new web server, does not work at all. What I've found with
Firebug is that for some reason it throws the absolute path away and looks
for OpenLayers.js in another location:

<address>/lib/OpenLayers.js

The OpenLayers library is made up of a complex directory tree, like this:

<rootdir>/OpenLayers.js
<rootdir>/Gears/a.js
<rootdir>/Gears/b.js
<rootdir>/BlahBlah/c.js

even worse, the JavaScript structure is ignored altogether, and the browser
tries to load the files as follows:

<address>/lib/OpenLayers.js
<address>/lib/a.js
<address>/lib/b.js
<address>/lib/c.js

If I put the library in the "/lib" path, only the first JS file gets loaded
correctly but the others don't, thereby causing the application to fail.
Looks like there is a serious problem with the way Struts rewrites and/or
handles relative and absolute paths.

I tried hard-wiring the path in the page or using the <html:base> tag in the
main page, but all my attempts have been unsuccessful so far.

Any help on this issue will be highly valued: thank you very much in
advance.

Emmanuele Sordini
-- 
View this message in context: 
http://www.nabble.com/Problems-with-javascript-files-in-Struts-based-webapp-tp22163997p22163997.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to