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

How to set a cookie that is persisted only for the duration fo the clients session?

1 Answers  


Can we define constructor in Servlet class?

10 Answers   Accenture, Yugma,


how to use servlets with j2ee ?

2 Answers   Tech Mahindra,


when the several requests comes to server..how it manage the requests

4 Answers   iGate,


Explain servlet events?

0 Answers  






How is an application exception handling is done using a servlet?

0 Answers  


What is the capacity that doGet method can send to the server?

5 Answers  


How to handle the debug errors in servlets?

2 Answers  


when the jsp page is translated to servlet?

5 Answers   HCL,


How do you define a servlet?

0 Answers  


What are the difference between HttpServlet and GenericServlets?

2 Answers  


What are the types of Session Tracking ?

0 Answers  


Categories