hi Shital,
Can you please enlighten me of what is the difference between Generic
Servlet and HttpServlet.
Ok let me first tell you of my understanding.. when your servlet extends
Generic Servlet the life cycle is init(), service(), destroy()...... and if
it extends HttpServlet the life cycle is init(), doGet(), doPost(),
destroy()......
How is our servlet which extends HttpServlet , invoke the doGet() method, if
the client request is get. and how is the doPost() method is invoked if the
client request is post....
can the same be achieved with a servlet which extends Generic Servlet.
regards
Chandra Shekar
----- Original Message -----
From: Shital Kanitkar <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 19, 2000 7:21 AM
Subject: Re: difference between doGet and doPost
> The differences between the doGet() and doPost() methods are that they are
> called in the HttpServlet that your servlet extends by its service()
method
> when it recieves a GET or a POST request from a HTTP protocol request.
> A GET request is a request to get a resource from the server. This is the
> case of a browser requesting a web page. It is also possible to specify
> parameters in the request, but the length of the parameters on the whole
is
> limited. This is the case of a form in a web page declared this way in
html:
> <form method="GET"> or <form>.
>
> A POST request is a request to post (to send) form data to a resource on
the
> server. This is the case of a form in a web page declared this way in
html:
> <form method="POST">. In this case the size of the parameters can be much
> greater.
>
> The GenericServlet has a service() method that gets called when a client
> request is made. This means that it gets called by both incoming requests
> and the HTTP requests are given to the servlet as they are (you must do
the
> parsing yourself).
>
> The HttpServlet instead has doGet() and doPost() methods that get called
> when a client request is GET or POST. This means that the parsing of the
> request is done by the servlet: you have the appropriate method called and
> have convenience methods to read the request parameters.
>
> NOTE: the doGet() and doPost() methods (as well as other HttpServlet
> methods) are called by the service() method.
>
> Concluding, if you must respond to GET or POST requests made by a HTTP
> protocol client (usually a browser) don't hesitate to extend HttpServlet
and
> use its convenience methods.
> If you must respond to requests made by a client that is not using the
HTTP
> protocol, you must use service().
>
> -Shital
>
>
___________________________________________________________________________
> 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