Hi
doGet() will be invoked when servlet receive GET request, and doPost() when
receive POST request. For example if you are passing parameter from HTML
form
<form name="form1" target="myServler" method="post">
When servlet received this request it will invoke doPost() method.
Other methods that will be called when servlet receive different kind of
request, for example, is doDelete()
Regards,
Tinnapat
----- Original Message -----
From: "Carter, Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 05, 2002 2:18 AM
Subject: Very begginer question
> I am guessing that the first method hit is doGet. When is the doPost
method
> run? What other special methods are there that execute at pre defined
> times? The example I am looking at is below, it is one of the free
examples
> that comes with the Tomcat web server.
>
> Thanks - Scott
>
>
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class RequestInfo extends HttpServlet {
>
> public void doGet(HttpServletRequest request, HttpServletResponse
> response)
> throws IOException, ServletException
> {
> response.setContentType("text/html");
> PrintWriter out = response.getWriter();
> out.println("<html>");
> out.println("<body>");
> out.println("<head>");
> out.println("<title>Request Information Example</title>");
> out.println("</head>");
> out.println("<body>");
> out.println("<h3>Request Information Example</h3>");
> out.println("Method: " + request.getMethod());
> out.println("Request URI: " + request.getRequestURI());
> out.println("Protocol: " + request.getProtocol());
> out.println("PathInfo: " + request.getPathInfo());
> out.println("Remote Address: " + request.getRemoteAddr());
> out.println("</body>");
> out.println("</html>");
> }
>
> /**
> * We are going to perform the same operations for POST requests
> * as for GET methods, so this method just sends the request to
> * the doGet method.
> */
>
> public void doPost(HttpServletRequest request, HttpServletResponse
> response)
> throws IOException, ServletException
> {
> doGet(request, response);
> }
> }
___________________________________________________________________________
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