Wednesday, September 14, 2011

Java Interview Questions - 73

How do I support both GET and POST protocol from the same Servlet?

The easy way is, just support POST, then have your doGet method call your doPost method:

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

No comments: