The problem of doGet method and doPost method in Java servlet

are these two methods called whenever an post request or a get request is encountered?
then, if there are multiple requests in a web page, isn"t it troublesome to call these two methods
to solve


get request call doGet,post request call doPost.
then I don't quite understand what you mean it's troublesome. Multiple requests in a web page do not necessarily call methods in the same Servlet.


at first, there is only the processRequest method, and all requests, whether get or post, are handled here, and then it is simply encapsulated to distinguish between doget and dopost APIs. You can also do further encapsulation similar to spring mvc, which is also post requests. Different methods are used to deal with them according to different url.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e80ec5-4585e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e80ec5-4585e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?