aspose file tools *
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
JavaRanch » Java Forums » Java » JSP
Bookmark "Referring Script outside WEB-INF" Watch "Referring Script outside WEB-INF" New topic
Author

Referring Script outside WEB-INF

Parameswaran Thangavel
Ranch Hand

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

contextroot/scripts/temp.js
contextroot/stylesheets/layoutStyles.css
contextroot/WEB-INF
contextroot/WEB-INF/JSP/temp.jsp

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é
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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
Sheriff

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.

JSP.2.0:


Legacy:

[ 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: http://aspose.com/file-tools
 
subject: Referring Script outside WEB-INF