give the syntax of doGet() and doPost()?

Answers were Sorted based on User's Feedback



give the syntax of doGet() and doPost()?..

Answer / 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

give the syntax of doGet() and doPost()?..

Answer / rajshri

public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
doGet(req,res)
}

public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
doPost(req,res)
}

Is This Answer Correct ?    13 Yes 1 No

Post New Answer

More Servlets Interview Questions

Describe in brief RequestDespatcher?

0 Answers   Tech Mahindra,


What is life cycle of Servlet?

0 Answers  


What's the servlet interface?

0 Answers  


Can we get PrintWriter and ServletOutputStream both in a servlet?

0 Answers  


What do you mean by scope object and what are its types?

0 Answers  






What is the difference between servlet and jsp?

0 Answers  


how the server will know its the same jsp page?

3 Answers   HCL,


Is servlet synchronized?

0 Answers  


What is session variable in servlets?

1 Answers  


What do you mean by request dispatcher in servlet?

0 Answers  


What is the advantage of Servlets when compared with other server side technologies?

0 Answers  


What is the difference between Difference between doGet() and doPost()?

0 Answers  


Categories