give the syntax of doGet() and doPost()?
Answers were Sorted based on User's Feedback
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 |
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 |
Can I override destroy() method of Servlets?
Explain the war file?
How does tomcat servlet container work?
Why is http protocol called as a stateless protocol?
Can we call destroy() method inside the init() method? What happens when we do so?
What are the objects involved when a servlet receives a call from client?
How variables can be accessed across the sessions?
What are the key methods that are involved in processing of http servlets?
how to use servlets with j2ee ?
What is the inter-servlet communication?
Explain the role of dispatcherservlet and contextloaderlistener.
How session tracking can be achieved, if your browser doesn't support cookies (or) if cookies are disabled?