You have to create a public noargs constructor such as:

public MyServlet(){
        //Do your stuff here
}

This is because, in the absense of *any* constructors, the Java VM pretends
that your class has a default (no args) constructor.  But when you supply
your own Constructors, the VM is no longer smart enough to pretend to call
the default constructor (why this is I don't know).

You also have to make sure that your no args constructor has public scope.
This is because another class is creating your Object.


Chris Gow

[EMAIL PROTECTED]

> -----Original Message-----
> From: SERVE 'EM - Dan Coggeshall [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, August 05, 1999 1:23 PM
> To:   [EMAIL PROTECTED]
> Subject:      Servlet Errors when a Constructor is present
>
> I am writing a servlet that runs fine, except when I write a constructor
> in the same class.
> I want to do this so that there is another entry point in my class.
> I've seen/heard it done before, but for some reason the returning HTML
> page says that no source (HTML source, I am hitting the servlet) was
> returned.  My service() isn't even using the constructor.  Any help?
>
> DanC
>
> __________________________________________________________________________
> _
> 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

Reply via email to