Hi Louis,

    First thing is that your class structure should preferable look like
WEB-INF/classes/com/iss/npd/servlets instead of
WEB-INF/com/iss/npd/servlets. Notice that the "classes" is missing in your
examples. Secondly you can get your current path in the servlet using

    String appPath = getServletContext().getRealPath("/");

This will give you an OS path of your application, so if your properties
file is "Config.props" in the WEB-INF/classes/com/iss/npd directory then
just load the properties using

    String configPath = appPath +
"/WEB-INF/classes/com/iss/npd/Config.props" ;

Hope this helps

Ajay Mahajan
Wipro Technologies

----- Original Message -----
Date: Mon, 18 Sep 2000 09:13:09 +0100
From: "Louis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: how to get the current path?
Message-ID: <004501c02148$4835c820$[EMAIL PROTECTED]>
Hi,
   I got a servlet and it will call another class.  In that class I need =
to read a properties file.  But i don't know where to put my properties =
file, I try to put anywhere, but still got file not found error.  So =
what method i can use to know the current path of that
class will reading?

for example,
The servlet testDB is in directory
     WEB-INF /com/iss/npd/servlets
And the class file dbConnect is in directory
    WEB-INF/com/iss/npd/database

The dbConnect will  read the database.properties file, anyone can tell =
me where I can put this file?

In JMC, Servlet Definitions I give this Name=3DtestDB, Class Name =3D =
com.iss.npd.servlets.testDB
then in Servlet URL Mappings, I give the Virtual Path/Extension =3D =
/testDB, Servlet Invoked =3D testDB


Thanks



Louis


------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

Reply via email to