File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Not getting path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Not getting path" Watch "Not getting path" New topic

Not getting path

Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
Hello All,

My directory structure are as follow:

I am not able to access any file in home.jsp. I tried to gave all kind of path in home.jsp such as ./css/logo.jpg, WEB-INF/css/logo.jpg, or ./WEB-INF/css/logo.jpg.

Can anyone help me?

Rob Spoor

Joined: Oct 27, 2005
Posts: 20180

Everything inside the WEB-INF folder is not accessible directly, only if you include it from a servlet or JSP, and with that I do not mean inside the HTML code itself (e.g. as the source of an image). Just move these folders outside the WEB-INF folder unless you really want them to be inaccessible.

How To Ask Questions How To Answer Questions
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63532

As already pointed out, script files, stylesheets and images need to be outside WEB-INF to be used from browser pages.

JSPs should remain under WEB-INF so that they are not directly accessible, but only available through their page controllers.

And be sure to use server-relative paths that start with the context path in your pages to all of the images, script file and stylesheets. See the JspFaq for more info.

[Asking smart questions] [About Bear] [Books by Bear]
Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
Thanks for all.
I agree. Here's the link:
subject: Not getting path
jQuery in Action, 3rd edition