Saturday, 23 April 2016

What will happen if Get request will be used to call servlet with Post method ?


Given following form :
<form action="register.do">
    <input type="text" name="Name">
    <input type="submit" value="Save">
</form>

and a servlet code : 
public class RegisterServlet extends HttpServlet {
   public void doPost(HttpServletRequest req, HttpServletResponse res) {
      // registration logic goes here
      return;
  }
}


Answer
Here, The registration fails because, above servlet don't have doGet() method.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.