aspose file tools*
The moose likes JSP and the fly likes problem in running external java Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem in running external java Script" Watch "problem in running external java Script" New topic
Author

problem in running external java Script

ganesh pol
Ranch Hand

Joined: Apr 29, 2005
Posts: 151
i stored my *.js files in WEB-INF folder

as

/WEB-INF/js/calendar.js
/WEB-INF/js/calendar-setup.js
/WEB-INF/js/calendar-en.js


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>
</script>



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
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem in running external java Script