tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: Quick Question
Date Tue, 13 Aug 2002 14:29:19 GMT
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 = 
        if (is == null) {
                return 0;
        else {
                return 1;

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

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)" <>
13/08/2002 08:11 a.m.
Please respond to Tomcat Users List

        To:     Tomcat Users List <>
        Subject:        RE: Quick Question

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

Use this code to find the directory where WEB-INF is.  Then you can 
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
    throws ServletException, IOException {
        //get working dir
        ServletContext sc = scon.getServletContext();
        workingDir = sc.getRealPath("");

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message