Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

problem with accessing a JS file

 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,
Im having problem with accessing a JS file placed in another folder from a JSP popup.

I tried all the following:
<SCRIPT LANGUAGE="JavaScript1.1"
SRC="../js/SpellCheckForm.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1"
SRC="/js/SpellCheckForm.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.1"
SRC="<%=request.getContextPath()%>/js/SpellCheckForm.js"></SCRIPT>

No options worked.

I am accessing files this way in other JSP files.

Not sure what can be the issue in one particular case?? Any pointers to debug?

the folder structure is as follows:
-webContent
----JSP
----JS

Regards,
Leena
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you receive any error by running this.. check your JavaSCript console inside of tool menu on FireFox.


I think you don't need to define a version inside a Language. It just what I am thinking! not sure about it.. Can someone clear me on that..
 
Marshal
Posts: 67449
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using page-relative addressing can be a problem in wab apps. It is recommened to use server-relative addressing as in your 3rd example.

Where does the file actually reside in relation to the context root?
[ March 23, 2007: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Leena,

-is it JS or js?
-did you check the generated HTML in your popup?

Herman
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't put relative src put absolute means with out ../
 
Don't play dumb with me! But you can try this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic