On Wed, 18 Aug 1999, Kumar Kartikeya wrote:

> ** Confidential **
OK ;-)
>
> Hi !
> I am new to servlet. I wanted to know that :
>
> 1)  Why constructor is not required to initialize the servlet instance ?
Because there is an ServletConfig that needs to be passed to the
servlet during its initialisation - init(ServletConfig config)

The init() method arguments may be forced at compile-time through
interfaces and abstract method declaration, while constructor's arguments,
or signature can not be enforced at compile-time - there is no such
thing as "abstract constructor method".

> 2)  How the servlet instance is created ?
It's servlet's engine task to ensure the servlets you write are
instantiated in order to answer requests that map to them.
They also make sure to call their init() method once, after creation and
before passing any requests to them.

> 3)  Can we create several instances of a servlet ?
An servlet-based application writer should not worry about creating
servlets. Just implement them.

> 4)  Why we avoid constructor to initialize servlet ?
see 1.

> 5)  What is common in servlet and Applet?
Not much. Historically I think Sun wanted to provide servlets as an
alternative for server-side java, opposed to applets wich are client-side.

some resemblance is in the <SERVLET > tag, looks like an <APPLET > tag
that needs to be executed on server. The funny thing is that <SERVLET >
tags and their expected behaviour are not discussed in current JSDK API.

The latest JSDK API specifications however makes servlets resembling
lightweight web application server environment/frameworks, with
sessions, application contexts.. not to mention JSP wich tends to
be tightly coupled with servlet API, as a standard template system
for servlets.

> thanks in advance..
>
> Kumar
>

welcome,
Cezar.

An elephant is a mouse with an operating system.

___________________________________________________________________________
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