give the syntax of doGet() and doPost()?

Answer Posted / malli

This is the example for doPost() and doGet();
In this example u can call the doPost() and doGet()like
follows:

Sample Example::
public class PrintCGI extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
printCGIValues(request, response); //doGet() calling
}

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
printCGIValues(request, response); //doPost() Calling
}

public void printCGIValues(HttpServletRequest request,
HttpServletResponse response) throws IOException {

//required lines of code

}
}

Is This Answer Correct ?    18 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you invoke a Servlet? What is the difference between doPost method and doGet method?

621


What is the web server used for running the Servlets?

563


What is string tokenizer?

607


What is the difference between servlet and filter?

502


Explain servlet life cycle?

591






What are the functions of the servlet container?

995


Why do we have servlet filters?

579


how many jsp scripting elements are there and what are those?

522


When a client request is sent to the servlet container, how does the container choose which servlet to invoke?

547


Difference between java beans & servlets?

569


What is the use of welcome-file-list?

552


What do you mean by cgi?

517


What is the difference between context parameter and context attribute?

505


How can we invoke another servlet in a different application?

684


What do you mean by httpservlet?

542