These exercises introduces the Spring MVC Controller and reviews our Maven setup, Slf4j, and log4j. We will review each of the files, annotations, and definitions we will use to create a simple Spring MVC project.

Ex-G2: Make a HelloSpringController2MavenProj using the instructions below

  1. Make a copy of our HelloSpringControllerMavenProj and name it HelloSpringController2MavenProj
  2. Set your pom.xml groupId to your own and the artifactId to hello-mvc-controller2
  3. Close HelloSpringControllerMavenProj . Use HelloSpringController2MavenProj for this exercise.

  4. Change the display name to HelloSpringController2
  5. Add a new index.jsp in the webapp folder
  6. <!DOCTYPE html>
    <jsp:forward page="greeting.htm"/>
    
  7. Change the servlet url to map *.htm
  8. Rename your web context root to hello-controller2
  9. Run the project – “Run As” -> “Run On Server” and choose our Tomcat Server

  10. Change the url pattern for the servlet to *.htm from *.html
  11. Note: STS and Eclipse may not automatically detect changes to xml and properties files.

  12. Restart the Tomcat Server or choose “Run As” -> “Run On Server” and choose our Tomcat Server again
  13. Browse to localhost:8080/hello-controller2