File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Referring Script outside WEB-INF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Referring Script outside WEB-INF" Watch "Referring Script outside WEB-INF" New topic

Referring Script outside WEB-INF

Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
hi all,
below is my Project folder structure


i tried to use the stylesheet in a temp.jsp page inside JSP folder,
i referred the stylesheet as

but it is not referred. the same case with the script file...
is there any problem in referring the source outside the WEB-INF.

Any pointers would appreciated...
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

I think that you should avoid relative paths,
and use absolute paths instead.
Like /scripts/temp.js

[My Blog]
All roads lead to JavaRanch
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Satou kurinosuke:
Like /scripts/temp.js

That won't work either.
The preceding slash tells the browser that this link is realative to the domain (the context path will be skipped).

Your best approach is to read the context path from the request object and then build your link; relative to that.



[ July 13, 2006: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Referring Script outside WEB-INF
It's not a secret anymore!