aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes locating a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "locating a file" Watch "locating a file" New topic
Author

locating a file

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 743
Hi, I have a directory structure similar to:

PROJECT FOLDER (proj)

pages scripts styles

where pages contains html files, scripts contains .js files, and .css
files in styles folder.

If myStyles.css is a file in styles folder,
and XXX.html is a file in pages folder.

I'm trying to use myStyles.css inside of XXX.html.
I cannot see why using the absolute path:

does not work.

However the following two options do work, but I'm not keen on the latter.


Can anyone explain whats wrong with "/styles/myStyles.css", and
what is the best approah here.

Thanks very much
[ March 09, 2006: Message edited by: colin shuker ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60080
    
  65

If the app root is proj, why would you expect it to work if you don't provide it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 743
Well I recently passed the SCWCD exam, and when referring to an html page outside of web-inf, I just used a /, then the pages name. Not the full path name.
See what I mean?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
/styles/myStyles.css looks for a folder named styles inside the current directoy.

Eric
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 743
But for scripts you need the full path name?
Eg proj/scripts/external.js
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You really need to read this: http://www.webreference.com/html/tutorial2/3.html

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: locating a file
 
Similar Threads
CSS displayed, CSS not displayed
Referring Script outside WEB-INF
external Stylesheet .css file in JSF
linking css and javascript with JSP pages
DisplayTag works but without colors!?