• 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 ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

problem in running external java Script  RSS feed

Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i stored my *.js files in WEB-INF folder



and defination of it in my jsp file is

<!-- this Script for Calender-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS Calendar (positioning test)</title>
<script type="text/javascript" src="/WEB-INF/js/calendar.js"></script>
<script type="text/javascript" src="/WEB-INF/js/calendar-setup.js"></script>
<script type="text/javascript" src="/WEB-INF/js/calendar-en.js"></script>
<style type="text/css"> @import
url("/WEB-INF/css/calendar-win2k-cold-1.css"); </style>

and create war of it

but when i try to open the file in browser it gives javascript error

i follow same way in prevoius application

and it works fine but difference is that i have not kept my *.js files in WEB-INF folder but at the same lavel as that of WEB-INF
and did not create WAR just deploy my application in webapps of Apache Tomcat

what is the problem in this case
is it because of war file
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Browsers can't access files residing under WEB-INF directory.
You'll need to either move them out of WEB-INF or write some code that streams their contents to the browser.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!