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
How do you invoke a Servlet? What is the difference between doPost method and doGet method?
What is the web server used for running the Servlets?
What is string tokenizer?
What is the difference between servlet and filter?
Explain servlet life cycle?
What are the functions of the servlet container?
Why do we have servlet filters?
how many jsp scripting elements are there and what are those?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
Difference between java beans & servlets?
What is the use of welcome-file-list?
What do you mean by cgi?
What is the difference between context parameter and context attribute?
How can we invoke another servlet in a different application?
What do you mean by httpservlet?