| Author |
Access a file into web-inf folder
|
Steeve Randria
Greenhorn
Joined: Sep 17, 2010
Posts: 16
|
|
Hello,
How can I access a file in the WEB-INF please?
My file is located in WEB-INF/xmlFiles/exemple.xml and I access via / example.xml into my program.
But this method works only on my own server JBoss, if I test on the production server, it no longer works because it can not find the file
Thanks a lot
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
You should always use ServletContext's getRealPath method for resolving any paths relative to the web application to actual paths that you can use with File, FileInputStream, etc.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Steeve Randria
Greenhorn
Joined: Sep 17, 2010
Posts: 16
|
|
Hello,
Thanks for your answer!
The problem that is I'm not in a servlet, but a simple POJO, so I can not call the ServletContext
It 's possible to know the path dynamically?
thanks a lot
|
 |
 |
|
|
subject: Access a file into web-inf folder
|
|
|