what is the need of doPost and DoGet method? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

what is the need of doPost and DoGet method?

if service can work in both type of request then why ?

18th Mar 2017, 11:53 AM
Somnath Ghosh
Somnath Ghosh - avatar
3 Respostas
+ 5
Then you should override and use service.
18th Mar 2017, 2:03 PM
TamƔs Barta
TamƔs Barta - avatar
+ 4
The service method calls doGet or doPost depending on request method. Of course you can handle everything in service. With doGet and doPost you can avoid checking request method. But why to do that? My opinion is it is better for security reasons that accept a request only in post or get, not both. For example don't accept login information via GET because sending sensitive parameters in the URL is not secure.
18th Mar 2017, 1:19 PM
TamƔs Barta
TamƔs Barta - avatar
0
ok...but if client can sent request in post and get both...then should i use service method Or should i use both method(dopost and doget) in servlet class?
18th Mar 2017, 1:50 PM
Somnath Ghosh
Somnath Ghosh - avatar