You do not have doPost() method overridden in your servlet, but you access the servlet with POST method, that's the reason why this exception is coming. To overcome this exception, override doPost() method or do not call this servlet with POST method..
Inside your servlet, if you have goGet() method & if you want to support GET & POST both, then add following code inside your class -
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
1
You should not use GET and POST interchangeably, the HTTP specification is very clear about that. The "solution" mentioned by Anurag Verma is thus not viable.
Anurag Verma wrote:Inside your servlet, if you have goGet() method & if you want to support GET & POST both, then add following code inside your class -
Having both doGet() and doPost() do the same thing is not a good practice. They both are there for different purposes.
if you want to support GET & POST both, then add following code
i know this is not good way, but if someone needs it, then this is the way
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
1
There's no way this is ever "needed" - it can easily be avoided by various means. And as pointed out already, it violates the HTTP spec, with all the adverse consequences that can have. So you should never advocate it.