My first ever experience in building servlet REST API.
Java, Maven, Mysql,Tomcat 9, IntelliJ IDEA(Ultimate version), Ubuntu 20.04
Creating a maven project.
What is Maven? Maven is a build automation tool that is mostly used in Java projects. Using maven as a build tool in my web servlet project was an amazing experience.
In Maven, a dependency is a JAR, ZIP, or another package that our current project requires to compile, build, test, and/or run. These dependencies are resolved and loaded from the local repository when we perform a build or execute a maven project. The dependencies are gathered in the pom.
The POM provides all required project information as well as plugin configurations for use throughout the build process. The build life cycle is the “when” and “how,” while it is the declarative expression of the “who,” “what,” and “where”.
A Java servlet does not have a main method. They include methods that you can use to hook into when a specific event occurs (For example - a click on the button, HTTP PUT request on a HttpServlet). During the creation of the servlet, I primarily focused on four methods while implementing. Those are,
- doPost (POST)
- doGet (GET)
- doDelete (DELETE)
- doUpdate (PUT)
Here is my Github repo regarding my implementation. Just Fork it and refer if you are passionate. https://github.com/pasindur99/Organizations-backend
Okay, this will be the end of the first chapter of my experience in creating java servlets. I will be soon again with another chapter on creating java servlets. Thank you for reading!! :)