You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <ne...@yahoo.com> on 2008/11/07 00:19:21 UTC

[OT] Re: How to open a file with struts

--- 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