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
How to commuincate between an applet and a servlet?
How do I know if java is running on linux?
What is the need of session tracking in web application?
Can we override destroy method in servlet?
How will two or three servlets interact or communicate with each other?
request parameter how to find whether a parameter exists in the request object?
What is api in servlet?
Why are servlets used?
What is difference between get and post method?
List some life cycle methods of a servlet.
Is dispatcher servlet a singleton?
How the typical servlet code look like ?
What is servlet instance?
Explain the working of service() method of a servlet.
What is a web container and what is its responsibility?