A collection of web pages to layout UI components.
A collections of Spring beans (controllers, services, etc).
Spring configurations (XML, Annotation, or Java).
Flow is always remain same for any technology.
UI -> xml -> Java -> DB
We will start building a Maven project for web-mvc now.
Create Maven project.
Right-click project go to project facet as below and click link.
Select dynamic web module. So that project will have webContent folder
Update your maven project
Add web.xml to project see location WEB-INF/web.xml in webContent below image show how to add it automatically.
Project structure will be looking like below.
Once folder structure is ready go for adding code in pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JBK_Spring_MVC</groupId>
<artifactId>JBK_Spring_MVC</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<!-- Generic properties -->
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Spring -->
<spring-framework.version>5.1.3.RELEASE</spring-framework.version>
</properties>
<dependencies>
<!-- Spring IOC start -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<!-- Spring IOC end -->
<!-- Servlet+JSP+JSTL start -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Servlet+JSP+JSTL end -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>