Re: Struts / tomcat 5.5 / File problem
- From: "Tom Dyess" <tdyess@xxxxxxxx>
- Date: Tue, 31 May 2005 08:28:25 -0400
Check out the package java.net.URLEncoder for URL encoding/decoding. You
could also reference the file as a relative path from your webroot. I would
recommend this approach for an actual production environment because you
should never use an absolute path. With an absolute path, that path must be
on any server you deploy your webapp on.
--
Tom Dyess
OraclePower.com
"Tom Vercauteren via JavaKB.com" <forum@xxxxxxxxxxxxxxxxx> wrote in message
news:f3bb1a19db334489a84cf93e949c3be7@xxxxxxxxxxxxx
> Hello,
>
> I'm just starting with struts, with the book : Struts in action.
>
> I use some classes from this book, and in one of them, there is a problem
> in my environment. (jdk 1.4.2_08, tomcat 5.5.9, struts 1.0.2)
>
> The application is a simple registerpage, where a user must give in a
> name,
> and twice the same password. The name & pw will be stored in a
> propertiesfile on the server.
>
> In one of the classes, we gone get the path to the propertiesfile with
> following code :
>
> String file = this.getClass().getClassLoader().getResource
> (UserDirectoryFile).getFile();
> outputstream = new FileOutputStream(o);
>
> But this isn't working.
> The value of file is : "C:/Program%20Files/Apache%20Software%
> 20Foundation/Tomcat%205.5/webapps/register/WEB-
> INF/classes/resources/users.properties"
>
> When i do : file = file.replaceAll("%20", " ");
> Then my code works.
>
> Isn't there any other solution to this problem? (where my code can
> understand %20 as spaces?)
>
> Thanks in advance,
> Tom
>
> --
> Message posted via JavaKB.com
> http://www.javakb.com/Uwe/Forums.aspx/java-general/200505/1
.
- References:
- Struts / tomcat 5.5 / File problem
- From: Tom Vercauteren via JavaKB.com
- Struts / tomcat 5.5 / File problem
- Prev by Date: BufferedImage
- Next by Date: JBoss XDoclet and Mail beginner question
- Previous by thread: Struts / tomcat 5.5 / File problem
- Next by thread: URGENT RXTX SERIAL PORT
- Index(es):
Relevant Pages
|