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 ? | 19 Yes | 4 No |
Post New Answer View All Answers
Write the code to get the server information in servlet.
Describe in brief RequestDespatcher?
What is ServletContext object?
How do you invoke a Servlet? What is the difference between doPost method and doGet method?
What is httpservlet and how it is different from genericservlet?
What is the purpose of inter-servlet communication?
What is cookie? Why is cookie used?
What are the differences between servlet context vs servlet config?
What exactly are the functions of servlet?
What do you mean by url pattern in servlet?
What is difference between GenericServlet and HttpServlet?
What are the types of servlets? Explain
What is a web application and what is it’s directory structure?
How does tomcat servlet container work?
What do you mean by web applications?