About HttpServlet () methods

I am a beginner in programming. This time, I will output about the HttpServlet method.

HttpServlet method overview

-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.

Why do I have to write ** @ Override ** before writing HttpServlet methods?

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

About HttpServlet () methods
About Ruby methods
About Ruby instance methods
About calling instance methods
Find out about class methods
About validation methods in JUnit
About naming Rails model methods
About pluck and ids methods
About =
About Java class variables class methods
About methods often used in devise
About Java static and non-static methods
About the equals () and hashcode () methods
[For our newcomers] About isXXX methods
About method.invoke
About Kotlin
About Hinemos
Java methods
About inheritance
About params
About Docker
About Rails 6
About form_for
About enum
About polymorphism
About Optional
About hashes
About JitPack
About Dockerfile
About this ()
About devise
Java methods
About encapsulation
About Docker
About JAVA_HOME
About active_hash
About static
About exceptions
About scope
Find out about instance methods and self
[Maven] About Maven
About Ruby regular expressions (metacharacters, captures, related methods)