Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing contents under WEB-INF directory

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Please let me know how we can access the contents under WEB-INF directory.

For e.g if i have project directory structure like below:

webapp
WEB-INF
jsp
jsp files...
js
javascript files....
classes
lib


Now if i want to use a javascript file externally in my jsp page what path to provide as the contents under WEB-INF are not accessible??

Thanks.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use servletContext.getResourceAsStream(resource_name)
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot directly access anything in the WEB-INF directory from the client. If you want to do anything like that you need to use a servlet as an intermediary
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So why, if you want them to be directly accessible, did you place the Javascript files under WEB-INF?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!