physical path of Webapp / Reading a file?

S

sven abels

Hi!

I've written a class that uses an xml-file to read it's configuration and it
works
fine in my programs.
I can read my confiuration file by accessing
....readSettings("settings.xml");...

I'd like to use my class in a Web-Application with Tomcat, too but whenever
I
want to read the file, I get the message, that Java/Tomcat searches for it
in
the tomcat-bin-directory.

Is there a way to read the xml-file from the WEB-INF/classes-directory or
is there a way to get the physical path of the current Web-Application in
a JSP/Servlet???
 
J

joe zobkiw

Is there a way to read the xml-file from the WEB-INF/classes-directory or
is there a way to get the physical path of the current Web-Application in
a JSP/Servlet???

I just read this this morning...sounds like just what you need...

http://developer.java.sun.com/developer/EJTechTips/2003/tt0626.html#1

In summary: The method javax.servlet.ServletContext.getResourcePaths
allows a Web component to query the container about the resources
contained in the Web archive.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,991
Messages
2,570,212
Members
46,800
Latest member
Tobi1987

Latest Threads

Top