[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools] Re: Tomcat/Servlet Resource File Location

Andreas H. wrote:
Hi,

I've got a small problem, couldn't find anything about it:

I'm using TomCat (6.0.20) in Eclipse Europa with WTP. I want to write some small servlets with database access where I want the db information provided by properties-files.
My problem is the following: How can I deploy those resource files so I can find the properties-files in a relative manner? I have tried to include them in the src-directory, as external files, add them to the build path, ... But I don't know where I should put them or how I should publish the small web project to be able to relatively access the resource files. Can someone give me hints on what to do here?


cheers,
meta

You could try something like the following to get an InputStream to read the properties:


Servlet.getServletConfig().getServletContext().getResourceAsStream("/WEB-INF/db.properties")

Error and exception handling to be added.

Cheers,
Larry