You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ariel <is...@gmail.com> on 2008/11/06 23:07:13 UTC
How to open a file with struts
Hi every body:
I want to open a file from an action Servlet to use it in the web
aplication, this file is located in the site root but I don´t know how to
referenced, when I open the file I do this:
File file = new File("MyFile.txt")
But an Exception is thrown because the file can´t be found
Could you help me to solve this problem ?
Thanks in advance.
Greetings
Ariel
[OT] Re: How to open a file with struts
Posted by Dave Newton <ne...@yahoo.com>.
--- On Thu, 11/6/08, Ariel wrote:
> I want to open a file from an action Servlet to use it in the web
> aplication, this file is located in the site root but I don´t know
> how to referenced, when I open the file I do this:
> File file = new File("MyFile.txt")
>
> But an Exception is thrown because the file can´t be found
>
> Could you help me to solve this problem?
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org