diff --git a/spring-mvc-basics/.gitignore b/spring-mvc-basics/.gitignore
new file mode 100644
index 0000000000..83c05e60c8
--- /dev/null
+++ b/spring-mvc-basics/.gitignore
@@ -0,0 +1,13 @@
+*.class
+
+#folders#
+/target
+/neoDb*
+/data
+/src/main/webapp/WEB-INF/classes
+*/META-INF/*
+
+# Packaged files #
+*.jar
+*.war
+*.ear
\ No newline at end of file
diff --git a/spring-mvc-basics/README.md b/spring-mvc-basics/README.md
index 46681afb48..63d046de2d 100644
--- a/spring-mvc-basics/README.md
+++ b/spring-mvc-basics/README.md
@@ -6,3 +6,4 @@
The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
+- [Spring MVC Tutorial](https://www.baeldung.com/spring-mvc-tutorial)
diff --git a/spring-mvc-basics/pom.xml b/spring-mvc-basics/pom.xml
index 777537b0b9..8217421948 100644
--- a/spring-mvc-basics/pom.xml
+++ b/spring-mvc-basics/pom.xml
@@ -1,4 +1,5 @@
-
4.0.0
com.baeldung
@@ -15,136 +16,33 @@
-
- org.springframework
+
+ org.springframework
spring-webmvc
${spring.version}
javax.servlet
javax.servlet-api
- 4.0.1
+ ${javax.servlet-api.version}
javax.servlet.jsp
javax.servlet.jsp-api
- 2.3.3
+ ${javax.jsp-api.version}
javax.servlet
jstl
${jstl.version}
-
-
-
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson.version}
-
-
- org.aspectj
- aspectjrt
- 1.9.1
-
-
- org.aspectj
- aspectjweaver
- 1.9.1
-
-
-
-
- commons-fileupload
- commons-fileupload
- ${commons-fileupload.version}
-
-
- commons-io
- commons-io
-
-
-
-
- net.sourceforge.htmlunit
- htmlunit
- 2.32
-
-
- commons-logging
- commons-logging
-
-
- commons-io
- commons-io
-
-
-
-
- commons-io
- commons-io
- ${commons-io.version}
-
-
-
-
- org.thymeleaf
- thymeleaf-spring4
- ${thymeleaf.version}
-
-
- org.thymeleaf
- thymeleaf
- ${thymeleaf.version}
-
-
-
- com.jayway.jsonpath
- json-path
- test
- 2.4.0
-
org.springframework
spring-test
- ${spring.version}
+ ${spring.version}
test
-
-
-
- org.apache.poi
- poi-ooxml
- ${poi.version}
-
-
-
-
- org.hibernate.validator
- hibernate-validator
- ${hibernate-validator.version}
-
-
-
-
-
- com.google.code.gson
- gson
- 2.8.5
-
-
- org.springframework
- spring-websocket
- ${spring.version}
-
-
-
- org.springframework
- spring-messaging
- ${spring.version}
-
@@ -155,144 +53,11 @@
true
-
-
-
-
- maven-resources-plugin
- ${maven-resources-plugin.version}
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
- ${maven-war-plugin.version}
-
- false
-
-
-
-
- org.codehaus.cargo
- cargo-maven2-plugin
- ${cargo-maven2-plugin.version}
-
- true
-
- jetty8x
- embedded
-
-
-
-
-
-
- 8082
-
-
-
-
-
-
-
-
- live
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- integration-test
-
- test
-
-
-
- **/*IntegrationTest.java
- **/*IntTest.java
-
-
- **/*LiveTest.java
-
-
-
-
-
-
- json
-
-
-
-
- org.codehaus.cargo
- cargo-maven2-plugin
-
- false
-
-
-
- start-server
- pre-integration-test
-
- start
-
-
-
- stop-server
- post-integration-test
-
- stop
-
-
-
-
-
-
-
-
-
-
- 3.0.9.RELEASE
-
-
- 6.0.10.Final
- 5.1.40
-
-
- 6.0.10.Final
-
-
- 19.0
- 3.5
- 1.3.2
- 2.5
- 2.2.0
-
-
- 4.4.5
- 4.5.2
- 3.0.7
- 2.23
-
-
- 3.2.2
- 2.7
- 1.6.1
- 3.1.0
-
-
- 1.9.1
-
-
- 3.16-beta1
-
- 3.0.1-b06
-
+ 4.0.1
+ 2.3.3
diff --git a/spring-mvc-basics/src/main/java/com/baeldung/spring/web/config/WebConfig.java b/spring-mvc-basics/src/main/java/com/baeldung/spring/web/config/WebConfig.java
new file mode 100644
index 0000000000..6ee20d7a6b
--- /dev/null
+++ b/spring-mvc-basics/src/main/java/com/baeldung/spring/web/config/WebConfig.java
@@ -0,0 +1,33 @@
+package com.baeldung.spring.web.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+import org.springframework.web.servlet.view.JstlView;
+
+@EnableWebMvc
+@Configuration
+@ComponentScan(basePackages = { "com.baeldung.web.controller" })
+public class WebConfig implements WebMvcConfigurer {
+
+ @Override
+ public void addViewControllers(final ViewControllerRegistry registry) {
+ registry.addViewController("/")
+ .setViewName("index");
+ }
+
+ @Bean
+ public ViewResolver viewResolver() {
+ final InternalResourceViewResolver bean = new InternalResourceViewResolver();
+ bean.setViewClass(JstlView.class);
+ bean.setPrefix("/WEB-INF/view/");
+ bean.setSuffix(".jsp");
+ bean.setOrder(0);
+ return bean;
+ }
+}
\ No newline at end of file
diff --git a/spring-mvc-basics/src/main/java/com/baeldung/web/controller/SampleController.java b/spring-mvc-basics/src/main/java/com/baeldung/web/controller/SampleController.java
new file mode 100644
index 0000000000..c13986e005
--- /dev/null
+++ b/spring-mvc-basics/src/main/java/com/baeldung/web/controller/SampleController.java
@@ -0,0 +1,13 @@
+package com.baeldung.web.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@Controller
+public class SampleController {
+ @GetMapping("/sample")
+ public String showForm() {
+ return "sample";
+ }
+
+}
diff --git a/spring-mvc-basics/src/main/resources/annotations.properties b/spring-mvc-basics/src/main/resources/annotations.properties
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/spring-mvc-basics/src/main/resources/mvc-configuration.xml b/spring-mvc-basics/src/main/resources/mvc-configuration.xml
new file mode 100644
index 0000000000..7505614c99
--- /dev/null
+++ b/spring-mvc-basics/src/main/resources/mvc-configuration.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+ /WEB-INF/view/
+
+
+ .jsp
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-basics/src/main/webapp/WEB-INF/view/index.jsp b/spring-mvc-basics/src/main/webapp/WEB-INF/view/index.jsp
new file mode 100644
index 0000000000..4f4eb0068d
--- /dev/null
+++ b/spring-mvc-basics/src/main/webapp/WEB-INF/view/index.jsp
@@ -0,0 +1,7 @@
+
+
+
+
+ This is the body of the index view
+
+
\ No newline at end of file
diff --git a/spring-mvc-basics/src/main/webapp/WEB-INF/view/sample.jsp b/spring-mvc-basics/src/main/webapp/WEB-INF/view/sample.jsp
new file mode 100644
index 0000000000..7cc14b5dcd
--- /dev/null
+++ b/spring-mvc-basics/src/main/webapp/WEB-INF/view/sample.jsp
@@ -0,0 +1,7 @@
+
+
+
+
+ This is the body of the sample view
+
+
\ No newline at end of file
diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md
index 3deeb21afc..2c0f594bd2 100644
--- a/spring-mvc-java/README.md
+++ b/spring-mvc-java/README.md
@@ -29,6 +29,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [A Quick Example of Spring Websockets’ @SendToUser Annotation](http://www.baeldung.com/spring-websockets-sendtouser)
- [Using Spring ResponseEntity to Manipulate the HTTP Response](http://www.baeldung.com/spring-response-entity)
- [Using Spring @ResponseStatus to Set HTTP Status Code](http://www.baeldung.com/spring-response-status)
-- [Spring MVC Tutorial](https://www.baeldung.com/spring-mvc-tutorial)
- [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters)
- [A Java Web Application Without a web.xml](https://www.baeldung.com/java-web-app-without-web-xml)
diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml
index 853d8db64c..ffa76d405d 100644
--- a/spring-mvc-java/pom.xml
+++ b/spring-mvc-java/pom.xml
@@ -34,7 +34,6 @@
javax.servlet
jstl
${jstl.version}
-