sperin
asked on
Reading a property file from WEB-INF/conf from a servlet
Hello All,
This is a pretty basic question. I want to know the standard way by which a properties file in the WEB-INF/conf can be retrieved by a servlet. That is the way in which it has the minimum dependencies with the appserver (i.e the directory in which the webapps is located, the make of appserver etc.)
I have used the init-param tags, but I had to give the full path (i.e C:\\Apache..) as the param value.
TYA,
QMS
This is a pretty basic question. I want to know the standard way by which a properties file in the WEB-INF/conf can be retrieved by a servlet. That is the way in which it has the minimum dependencies with the appserver (i.e the directory in which the webapps is located, the make of appserver etc.)
I have used the init-param tags, but I had to give the full path (i.e C:\\Apache..) as the param value.
TYA,
QMS
Thread.currentThread().get ContextCla ssLoader() .getResour ceAsStream ("/conf/x. properties ");
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please tell us which work and which don't before accepting sperin
> Please tell us which work and which don't before accepting sperin
I think you're supposed to tell sperin what works :-D
I think you're supposed to tell sperin what works :-D
Thanks sperin :)
Let me know if you have any further questions.
Let me know if you have any further questions.
!?
ASKER
Will tell you chaps about it. I was aware of a ServletContext object, so I too a wild guess and accepted the reply from objects. Now if that does'nt work, well my bad luck :)
LOL. Aside from rudely ignoring my request, you'd have thought from your point of view it might be just slightly useful to check the answers before making a choice.
:)
URLConnection conn = new URLConnection("/WEB-INF/co