At 12:11 PM 8/20/99 +0530, you wrote:
>Hi Joona,
>        You can have constructors but those constructors cannot have
arguments.
>        You can instead use the init() method as a substitute for constructor
>        with argument.
>
>Manu.

Righto. But what if I need to use a servlet object without running it as a
servlet? Here's what I want to be able to do:

class FunkyServlet extends javax.http.HttpServlet
{
  public FunkyServlet(String arg)
  {
    System.out.println("I'm a funky servlet, instantiated like a Java class");
    System.out.println("I got an argument: "+arg);
  }
  public void doGet(HttpRequest request, HttpResponse response) throws
  ServletException, IOException
  {
    System.out.println("I'm a funky servlet, run from a HTTP GET request");
    // here's where I write what the servlet does with doGet
  }
}

class ConsoleApplication
{
  // there are some methods here
  public void someMethod()
  {
    new FunkyServlet("my argument");
  }
}

Is this in any way possible? If so, please tell me how! Thanks!

Joona Palaste

___________________________________________________________________________
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