aspose file tools*
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
Author

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?

Regards,
Kasparov
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19792
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

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] [Bear's FrontMan] [About Bear] [Books by Bear]
Kasparov Patel
Ranch Hand

Joined: Jan 23, 2012
Posts: 40
Thanks for all.
 
Don't get me started about those stupid light bulbs.
 
subject: Not getting path