Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » File paths in static web project(Can't get relative file paths working)
File paths in static web project [message #668247] Wed, 04 May 2011 12:05 Go to next message
Al Roark is currently offline Al Roark
Messages: 2
Registered: May 2011
Junior Member
All:
I'm building my first web site and am using Eclipse + WTP to do so. One annoyance I have is that the only way I can view previews of my site (using the built-in Preview Server) while developing it is to use absolute file references to the resources on my local machine (e.g. D:\httpdocs\css\). This has become problematic because when I upload my files to the web server, all of the file references are invalid and I have to change them manually. I can't imagine this is how most people operate and am wondering how others get around this problem. Ideally, I'd like to use file paths during development that reflect the structure of my (DailyRazor's) web server. So, instead of coding links to css files using "D:\httpdocs\css" I'd like to have Eclipse recognize "/httpdocs/css". FYI: I'm using Helios on Windows 7.
Thanks Much!
Re: File paths in static web project [message #668272 is a reply to message #668247] Wed, 04 May 2011 14:37 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2237
Registered: July 2009
Senior Member
What kind of relative links are not working as expected? Can you include the full workspace-relative paths to files you're linking from and to in an example with the link value?

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: File paths in static web project [message #668275 is a reply to message #668272] Wed, 04 May 2011 15:07 Go to previous messageGo to next message
Al Roark is currently offline Al Roark
Messages: 2
Registered: May 2011
Junior Member
Thanks for your reply, Nitin.

I have a project called 'HelloWorld' located on my machine at 'D:\HelloWorld'. This project folder contains a folder called 'httpdocs', which in turn contains a folder called 'css' as well as an 'index.html' file.

Viewing the properties for the folder 'css' from Eclipse shows the Path to be '/HelloWorld/httpdocs/css'.

The 'index.html' file contains a link to a stylesheet in the 'css' folder, which looks like:

<link rel="stylesheet" type="text/css" href="/css/style1.css" title="style1">

I've tried numerous values for href, including the entire path (/HelloWorld/httpdocs/css/style1.css), though the only thing that has worked for me is using the Windows file path.

Cheers
Re: File paths in static web project [message #669560 is a reply to message #668275] Tue, 10 May 2011 14:10 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2237
Registered: July 2009
Senior Member
The first question is whether this is a Static or Dynamic Web Project. Being either should set up the necessary metadata so that we know that '/' refers to /HelloWorld/httpdocs. Otherwise you'll have to use truly relative paths.

---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Update Project Explorer with new contents of war file
Next Topic:IWAB0523E Error moving resource: ...... Could not read from source when writing file
Goto Forum:
  


Current Time: Tue Jul 29 23:04:18 EDT 2014

Powered by FUDForum. Page generated in 0.02648 seconds