- This requires
Maven
to be installed in your system, which can be obtainer via intellij IDE (Community/Ultimate) or from the official website ofMaven
. - This project is a simple demonstration of how to create a
Servlet
usingMaven
inIntelliJ IDE
. - Check the
dependencies
in thepom.xml
file. The below are the new dependencies to be added in youpom.xml
file.
<!-- https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-core -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>11.0.2</version>
</dependency>
Important
- This is a template to create a
Servlet
usingMaven
inIntelliJ IDE
. - One can create either an
HTML
or aJSP
file under thewebapp
directory. - Below is the directory structure of the project. Check for the
src
andwebapp
directories to create theServlet
and (HTML
orJSP
) files respectively.
Directory structure:
└── avidhanr-servletsusingmaven/
├── README.md
├── pom.xml
├── .prettierignore
├── .prettierrc
├── src/
│ └── main/
│ ├── java/
│ │ └── com/
│ │ └── itsvidhanreddy/
│ │ └── ServletMiddlewareToAddData.java
│ └── webapp/
│ ├── index.html
│ └── WEB-INF/
│ └── web.xml
└── .smarttomcat/
└── ServletsUsingMaven/
└── conf/
├── catalina.policy
├── catalina.properties
├── context.xml
├── jaspic-providers.xml
├── jaspic-providers.xsd
├── logging.properties
├── server.xml
├── tomcat-users.xml
├── tomcat-users.xsd
└── web.xml