Hi all,

I'm trying to resolve this problem with all the solutions that you gave 
me,  but it doesn't work...
This is what I did:

in my java bean (not a servlet), I have this code:


public class DbBean {
   public  int Connect()  {
   InputStream is = 
Thread.currentThread().getContextClassLoader().getResourceAsStream("config.txt");
        if (is == null) {
                return 0;
        }
        else {
                return 1;
        }
}


then in my jsp, I called this method, and then I write the value (0 or 
1)..

The txt file is in "WEB-INF/classes/beans...", because "DbBean" is in a 
package called "beans", and I start tomcat from TOMCAT_HOME/bin..
When I load the jsp, the method Connect of the DbBean (java bean) returned 
0, which means the InputStream is null, but if I put the txt file in
TOMCAT_HOME/bin, I had no problem...., the method returned 1....  why is 
that??.. I'm using Tomcat 3.2
Do I need to set something else in Tomcat??....

thanks again
Alex Tomita













"Drinkwater, GJ (Glen)" <[EMAIL PROTECTED]>
13/08/2002 08:11 a.m.
Please respond to Tomcat Users List

 
        To:     Tomcat Users List <[EMAIL PROTECTED]>
        cc: 
        Subject:        RE: Quick Question




tomcats default directory is where ever you called the startup.sh/bat 
file.
So if you dont use another script to call the startup.sh/bat file tomcats
default will be the bin directory.

Use this code to find the directory where WEB-INF is.  Then you can 
traverse
your directory structure from there. 

//get context path
    ServletConfig scon = null ;
    String workingDir = null;
 
    public void init(ServletConfig config) {
        scon = config ;
     }
 public void doPost(HttpServletRequest request, HttpServletResponse
response)
    throws ServletException, IOException {
 
        //get working dir
        ServletContext sc = scon.getServletContext();
        workingDir = sc.getRealPath("");


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to