It looks like your are declaring a private variable inside a
method. Private modifiers are only allowed on class variables.
try taking out the private keyword.
--Monte Glenn Gardner
On Mon, 1 Oct 2001, Ashur M. Albertson wrote:
> I am trying to make an instance of one of my classes in a servlet class, as
> I have done countless times in non-servlet, plain-vanilla Java
> classes. For example:
>
> public class DbConn
> {
> public DbConn()
> {
> ...
> }
> }
>
> --- AND ---
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class CurrStudent extends HttpServlet
> {
> public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException
> {
> private DbConn db = new DbConn(); // <-- HERE
> ...
> }
> }
>
> However, when I compile the CurrStudent class, I get the following error:
>
> CurrStudent.java:__: cannot resolve symbol
> symbol : class DbConn
> location: class CurrStudent
> DbConn db = new DbConn();
> ^
> Why can't the compiler find the DbConn class? Do I need to do something
> special because the instantiating class is a servlet?
>
> Thanks for any help,
> Ashur
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html