Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 69835 invoked by uid 500); 22 Sep 2001 17:45:40 -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 69824 invoked from network); 22 Sep 2001 17:45:40 -0000 From: BlyonsJ2EE@aol.com Message-ID: Date: Sat, 22 Sep 2001 13:45:36 EDT Subject: How to Instaniate Bean from Servlet? To: tomcat-user@jakarta.apache.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="part1_de.1ad83f6b.28de2840_boundary" X-Mailer: AOL 4.0 for Windows 95 sub 10 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --part1_de.1ad83f6b.28de2840_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hello, I am having a problem instaniating a Javabean from a Servlet. When compiling the Servlet the following error occurs: 'cannot resolve symbol: Linkbean linkbean = new LinkBean();' I have run this servlet before instaniating the bean in the same manner with Weblogic. Any help as to where to but bean class files, and why this error is occuring with Tomcat is greatly appreciated. For convenience I have attached the source code for the Servlet. Thanks, Brian --part1_de.1ad83f6b.28de2840_boundary Content-Type: text/plain; name="GETBEA~1.JAV" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="GETBEA~1.JAV" package com.wrox.projsp.ch03.myfirstwebapp; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; import java.sql.*; public class GetBean extends HttpServlet { public void init(ServletConfig config) throws ServletException { super.init(config); } public void doGet(HttpServletRequest request, HttpServletResponse response= ) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out =3D response.getWriter(); Connection con =3D null; Statement stmt =3D null; ResultSet rs =3D null; String error =3D null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; con =3D DriverManager.getConnection("jdbc:odbc:LINKS","",""); stmt =3D con.createStatement(); String sql =3D "Select * Links"; rs =3D stmt.executeQuery(sql); while(rs.next()){ LinkBean linkbean =3D new LinkBean(); linkbean.setValue(rs.getString("VALUE")); linkbean.setNavText(rs.getString("NAVIGATION_TEXT")); request.setAttribute("linkbean",linkbean); RequestDispatcher dispatcher =3D request.getRequestDispatcher("/jsp/We= lcome.jsp"); dispatcher.forward(request, response); } } catch (ClassNotFoundException e) { error =3D "Could not load database driver: " + e.getMessage(); out.println(error); } catch (SQLException e) { error =3D "SQL Exception Caught: " + e.getMessage(); out.println(error); } finally { try { if (con !=3D null) con.close(); } catch (SQLException ignored) {} } } } --part1_de.1ad83f6b.28de2840_boundary--