Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Understand doPost() and doGet() parameters

843838May 6 2007 — edited May 6 2007
Hi,
I've realized a web project using JSP and servlet;
All works fine!

But I want to better understand what happens when doPost or doGet method is invoked;

that is, a simple servlet look like this:
public class SimpleServlet 
    extends javax.servlet.http.HttpServlet 
    implements javax.servlet.Servlet  {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) 
                throws ServletException, IOException {

		this.doPost(request, response);
	} 	
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) 
             throws ServletException, IOException {

        }
My questions:

1) As HttpServletRequest and HttpServletResponse are interfaces, the request and response parameter are interfaces?
or Does it mean request and response must be objects of a Class that implements, respectively, HttpServletRequest and HttpServletResponse?

2)Then, who does invoke doGet() and doPost() methods?
The webserver?
3)What way does the caller use in order to create request and response objects, that must be passed to doPost and doGet?

I hope it's clear.

Thank you in advance.
MargNat
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2007
Added on May 6 2007
4 comments
1,934 views