Which is the default HTTP method?

If in your request html you do not put any HTTP method. Then by default it is GET.
<form action=”hello.do”> -no HTTP method. Means GET.
So if your servlet has only the overridden doPost() method then it is a problem.
So always you have to keep both doGet() and doPost() in your servlet.
Write the logic in doGet() and call it inside doPost(). Like this
doGet(ServletRequest a,ServletResponse b){ //servlet logic}
doPost(ServletRequest request,ServletResponse response){doGet(request,response)}

1 comment: