This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes Accessing contents under WEB-INF directory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Accessing contents under WEB-INF directory" Watch "Accessing contents under WEB-INF directory" New topic
Author

Accessing contents under WEB-INF directory

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
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.


Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2300
Use servletContext.getResourceAsStream(resource_name)


Rahul Bhattacharjee
LinkedIn - Blog
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Jan 10, 2002
Posts: 56201
    
  13

So why, if you want them to be directly accessible, did you place the Javascript files under WEB-INF?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing contents under WEB-INF directory
 
Similar Threads
Include Jsp in Jsp
NetBeans 6.0.1 - Web App Question
jQuery form submit using Form plugin not working
How to Generate a War file
problem in running external java Script