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
What is a servlet-to-servlet communcation?
What are its drawbacks of cgi?
Can a jsp be called using a servlet?
How the JSP file will be executed on the Server side?
What exactly are the functions of servlet?
When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?
When should you prefer to use doget() over dopost()?
Can you create a deadlock condition on a servlet?
What is the process to implement doget and dopost methods?
What is the use of send redirect () method?
What do you mean by deployment descriptor?
Can we override servlet service method?
How to get the IP address of client in servlet?
What are all the ways for session tracking?
What is the use of java servlet api?