Relative file path problem while running JSF Project in eclipse with Tomcat runtime [message #200655] |
Wed, 26 September 2007 23:07  |
Eclipse User |
|
|
|
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 08:34  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.09267 seconds