listTutorials() {
+ return Arrays.asList(
+ new Tutorial(1, "Guava", "Introduction to Guava", "GuavaAuthor"),
+ new Tutorial(2, "Android", "Introduction to Android", "AndroidAuthor")
+ );
+ }
+}
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm
new file mode 100644
index 0000000000..41bb36ce5e
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/footer.vm
@@ -0,0 +1,4 @@
+
+ @Copyright baeldung.com
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm
new file mode 100644
index 0000000000..8fffa6cdab
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/fragments/header.vm
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm
new file mode 100644
index 0000000000..203e675cfb
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/layouts/layout.vm
@@ -0,0 +1,22 @@
+
+
+ Spring & Velocity
+
+
+
+ #parse("/WEB-INF/fragments/header.vm")
+
+
+
+
+
+
+ $screen_content
+
+
+
+
+ #parse("/WEB-INF/fragments/footer.vm")
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml
new file mode 100644
index 0000000000..8b4fd570fe
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/mvc-servlet.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml
new file mode 100644
index 0000000000..2f3b0f19bb
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/spring-context.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm
new file mode 100644
index 0000000000..d1ae0b02cb
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/views/index.vm
@@ -0,0 +1,19 @@
+Index
+
+Tutorials list
+
+
+ Tutorial Id |
+ Tutorial Title |
+ Tutorial Description |
+ Tutorial Author |
+
+#foreach($tut in $tutorials)
+
+ $tut.tutId |
+ $tut.title |
+ $tut.description |
+ $tut.author |
+
+#end
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml b/spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..72050c0d37
--- /dev/null
+++ b/spring-mvc-velocity/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,32 @@
+
+
+
+ Spring MVC Velocity
+
+
+ mvc
+ org.springframework.web.servlet.DispatcherServlet
+
+ contextConfigLocation
+ /WEB-INF/mvc-servlet.xml
+
+ 1
+
+
+
+ mvc
+ /*
+
+
+
+ contextConfigLocation
+ /WEB-INF/spring-context.xml
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
\ No newline at end of file
diff --git a/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java
new file mode 100644
index 0000000000..332c4d4c33
--- /dev/null
+++ b/spring-mvc-velocity/src/test/java/com/baeldung/mvc/velocity/test/NavigationControllerTest.java
@@ -0,0 +1,44 @@
+package com.baeldung.mvc.velocity.test;
+
+
+import com.baeldung.mvc.velocity.controller.MainController;
+import com.baeldung.mvc.velocity.domain.Tutorial;
+import com.baeldung.mvc.velocity.service.TutorialsService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.springframework.ui.ExtendedModelMap;
+import org.springframework.ui.Model;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class NavigationControllerTest {
+
+ private final MainController mainController = new MainController(Mockito.mock(TutorialsService.class));
+
+ private final Model model = new ExtendedModelMap();
+
+ @Test
+ public final void shouldGoToTutorialListView() {
+ Mockito.when(mainController.getTutService().listTutorials())
+ .thenReturn(createTutorialList());
+
+ final String view = mainController.listTutorialsPage(model);
+ final List tutorialListAttribute = (List) model.asMap().get("tutorials");
+
+ assertEquals("index", view);
+ assertNotNull(tutorialListAttribute);
+ }
+
+
+ private static List createTutorialList() {
+ return Arrays.asList(new Tutorial(1, "TestAuthor", "Test Title", "Test Description"));
+ }
+}
diff --git a/xml/pom.xml b/xml/pom.xml
index 9d88bd75eb..d204eea45f 100644
--- a/xml/pom.xml
+++ b/xml/pom.xml
@@ -27,12 +27,6 @@
2.0.6
-
- xerces
- xercesImpl
- 2.9.1
-
-
commons-io
diff --git a/xml/src/test/resources/example_new.xml b/xml/src/test/resources/example_new.xml
index 020760fdd3..646d938869 100644
--- a/xml/src/test/resources/example_new.xml
+++ b/xml/src/test/resources/example_new.xml
@@ -1,10 +1,9 @@
-
-
-
-
- XML with Dom4J
- XML handling with Dom4J
- 14/06/2016
- Dom4J tech writer
-
-
+
+
+
+ Jaxb author
+ 04/02/2015
+ XML Binding with Jaxb
+ XML with Jaxb
+
+