I am a beginner in programming. This time, I will output about the HttpServlet method.
-Protected void doGet (HttpServletRequest request, HttpServletResponse response) -Protected void doPost (HttpServletRequest request, HttpServletResponse response) -Protected void doPut (HttpServletRequest request, HttpServletResponse response) -Protected void doHead (HttpServletRequest request, HttpServletResponse response) etc.... These are what you need to write when you want to receive HTTP methods in Servlet. Called by the server (via the service method) to allow the Servlet to handle HTTP requests by writing a method for the HttpServlet.
For example If you just want to save the user information in the DB by newly registering the user, I think that the HTTP method will be POST, so For Servlet, protected void doPost(HttpServletRequest request,HttpServletResponse response) It means that you need to write and write the process in it.
To be honest, I don't understand it properly and I understand only the atmosphere, so I will post the URL with the explanation below. About @Override At the beginning of this page,
Provides an abstract class that assumes subclassing to generate an HTTP Servlet suitable for your website. Subclasses of HttpServlet need to override at least one of the methods listed below.
doGet method, if the Servlet supports HTTP GET requests doPost method, when supporting HTTP POST request When supporting doPut method, HTTP PUT request
I think it says. This is the reason, so please read it.
The content is quite fluffy every time. I'm sorry Also, if there are any improvements or mistakes, I'm sorry, but I would appreciate it if you could let me know in the comments.
Recommended Posts