Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Relative file path problem while running JSF Project in eclipse with Tomcat runtime
Relative file path problem while running JSF Project in eclipse with Tomcat runtime [message #200655] Thu, 27 September 2007 03:07 Go to next message
Samrat Dhillon is currently offline Samrat DhillonFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

When I run a JSF based web project inside Eclipse, the bean associated
with the page has to create a file object which should be relative to
the project location. But whenever I create a file object in a
web-application project, the file object that is created has a path
relative to the Eclipse installation directory rather than the web
project directory.

Can anyone help me out?

(In a simple java project the file object's path is always relative to
the project directory)


Regards
Samrat Dhillon
Re: Relative file path problem while running JSF Project in eclipse with Tomcat runtime [message #200722 is a reply to message #200655] Fri, 28 September 2007 12:34 Go to previous message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
I don't believe the Servlet spec makes any promises about the "current
directory" when a web application is running, so relative paths are
likely to be trouble. The Servlet spec does provide a
"javax.servlet.context.tempdir" context attribute whose value is a
java.io.File object for a directory which may be read and written.
Alternatively, you could provide an absolute path as some form of
configuration setting for your webapp.

Cheers,
Larry

Samrat Dhillon wrote:
> Hi,
>
> When I run a JSF based web project inside Eclipse, the bean associated
> with the page has to create a file object which should be relative to
> the project location. But whenever I create a file object in a
> web-application project, the file object that is created has a path
> relative to the Eclipse installation directory rather than the web
> project directory.
>
> Can anyone help me out?
>
> (In a simple java project the file object's path is always relative to
> the project directory)
>
>
> Regards
> Samrat Dhillon
Previous Topic:html treated as jsp
Next Topic:Thread from STP Group
Goto Forum:
  


Current Time: Thu Apr 25 05:03:38 GMT 2024

Powered by FUDForum. Page generated in 0.02773 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top