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
Is it good idea to create servlet constructor?
What are the types of servlet?
What is dispatcher servlet?
What are the uses of servlets?
How can the referrer and the target urls be used in servlet?
What exactly is a servlet?
Can servlet have a constructor ?
How can you start a jta transaction from a servlet deployed on jboss?
How can you create a session in servlet?
Why do we need servlet filter?
What is SingleThreadModel interface?
What is servlet in web technology?
When should you prefer to use doget() over dopost()?
What do you mean by request dispatcher in servlet? Also explain its methods.
What is the web server used for running the Servlets?