Spring 3 MVC hello world example
In this tutorial, we show you a Spring 3 MVC hello world example, using Maven build tool.
Technologies used :
- Spring 3.2.13.RELEASE
- Maven 3
- JDK 1.6
- Eclipse 4.4
- Boostrap 3
Spring 4 MVC XML
Try this Spring 4 MVC hello world example.
Try this Spring 4 MVC hello world example.
Spring 3 MVC Annotation
Try this Spring 3 MVC hello world annotation example.
Try this Spring 3 MVC hello world annotation example.
1. Project Structure
Download the project source code and review the project folder structure :
2. Maven
A pom.xml
template to quick start a Spring MVC project, it defines Spring 3 dependencies, an embedded Jetty container and Eclipse workspace configuration.
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong</groupId>
<artifactId>spring3-web</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>spring css</name>
<properties>
<jdk.version>1.6</jdk.version>
<spring.version>3.2.13.RELEASE</spring.version>
<jstl.version>1.2</jstl.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<!-- embedded Jetty server, for testing -->
<plugin>
<groupId