Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 40873 invoked by uid 500); 6 Aug 2001 16:49:27 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 40864 invoked from network); 6 Aug 2001 16:49:26 -0000 Received: from web13407.mail.yahoo.com (216.136.175.65) by h31.sny.collab.net with SMTP; 6 Aug 2001 16:49:26 -0000 Message-ID: <20010806164928.19156.qmail@web13407.mail.yahoo.com> Received: from [199.245.82.118] by web13407.mail.yahoo.com; Mon, 06 Aug 2001 09:49:28 PDT Date: Mon, 6 Aug 2001 09:49:28 -0700 (PDT) From: "A.L." Subject: RE: Servlet Uses Another Class To: tomcat-user@jakarta.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N --- Filip Hanik wrote: > did you set your classpath before compiling? > > > C:\work\jt\tomcat\webapps\jd\WEB-INF\classes>javac > -classpath .;%CLASSPATH% > Calendar.java > > Filip > > ~ > Namaste - I bow to the divine in you > ~ > Filip Hanik > Software Architect > filip@filip.net > www.filip.net > > >-----Original Message----- > >From: A.L. [mailto:amoslieber@yahoo.com] > >Sent: Monday, August 06, 2001 9:21 AM > >To: tomcat-user@jakarta.apache.org > >Subject: RE: Servlet Uses Another Class > > > > > >Paul, > > i appreciate your help. I haven't been able to > get > >any servlet I have created to work which imports > >another clas for some reason. SO what I am > currently > >trying to do is use an example from the Oreilly > >Servlet book. Unfortunately the book doesn't have > a > >solution to the problem I am experiencing. The > >previous use of the terms myClass and Myservlet > were > >used to simplify things. The real java files are > >Calendar.java and HtmlSqlResult.java. Calendar is > the > >Servlet which creates an instance of HtmlSqlResult. > > > > > >HtmlSqlResult is compiling fine. I currenlty have > it > >in the same directory as Calendar.java. Now when I > >try to compile Calendar.java I get the following > >error: > > > >C:\work\jt\tomcat\webapps\jd\WEB-INF\classes>javac > >Calendar.java > >Calendar.java:8: cannot resolve symbol > >symbol: class HtmlSQLResult > >import HtmlSQLResult; > >^ > >Calendar.java:59: cannot resolve symbol > >symbol : class HtmlSQLResult > >location: class Calendar > > HtmlSQLResult result; > > ^ > >2 errors > > > > > > > >Here is the code for Calendar.java : > > > > > > > >import HtmlSQLResult; > >import javax.servlet.*; > >import javax.servlet.http.*; > >import java.io.*; > >import java.sql.*; > >/** > > * > > * @author alieberman > > * @version > > */ > >public class Calendar extends HttpServlet { > > private Connection con = null; > > public void init() throws ServletException { > > try > > { > > > >Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); > > con = > >DriverManager.getConnection("jdbc:odbc:calendar"); > > } > > catch (ClassNotFoundException e){ > > throw new UnavailableException("Couldn't > load > >database driver"); > > } > > > > catch (SQLException e) { > > throw new UnavailableException("Couldn't > Get > >db Connection"); > > } > > } > > > > /** Destroys the servlet. > > */ > > public void destroy() { > > try { > > if (con!=null) con.close(); > > } > > catch (SQLException ignored) {} > > > > } > > > > /** Processes requests for both HTTP > >GET and POST methods. > > * @param request servlet request > > * @param response servlet response > > */ > > protected void > processRequest(HttpServletRequest > >request, HttpServletResponse response) > > throws ServletException, java.io.IOException { > > response.setContentType("text/html"); > > java.io.PrintWriter out = > >response.getWriter(); > > > > out.println(""); > > out.println(""); > > out.println("Calendar"); > > out.println(""); > > out.println(""); > > HtmlSQLResult result; > > out.println(""); > > out.println(""); > > > > out.close(); > > } > > > > /** Handles the HTTP GET method. > > * @param request servlet request > > * @param response servlet response > > */ > > protected void doGet(HttpServletRequest > request, > >HttpServletResponse response) > > throws ServletException, java.io.IOException { > > processRequest(request, response); > > } > > > > /** Handles the HTTP POST method. > > * @param request servlet request > > * @param response servlet response > > */ > > protected void doPost(HttpServletRequest > request, > >HttpServletResponse response) > > throws ServletException, java.io.IOException { > > processRequest(request, response); > > } > > > > /** Returns a short description of the servlet. > > */ > > public String getServletInfo() { > > return "Short description"; > > } > > > >} > > > > > > > > > > > > > > > > > > > > > >--- Paul Foxton wrote: > >> hmmm. > >> > >> where does the error occurr? the first time you > >> actually use the class in > >> the servlet and after the import statement? > >> > >> if so it seems you must be importing it ok, so > the > >> there's another problem. > >> > >> If you get the error actually on the import > >> statement then perhaps you have > >> the name of the class wrong in your servlet? > >> > >> if you post the code and the error message, might > be > >> able to help more.... > >> > >> cheers, > >> > >> Paul > >> > >> > >> > -----Original Message----- > >> > From: A.L. [mailto:amoslieber@yahoo.com] > >> > Sent: 06 August 2001 16:52 > === message truncated === __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/