Chapter 4. Using Spring MVC to Build Web Pages
In the previous chapters you built your photo album's domain model, mapped it to a database, and made sure that everything worked properly with a series of unit and integration tests. In this chapter you are ready to start showing some pictures!
Before showing the pictures, however, you will need to understand what the MVC acronym stands for. Then you can jump into the details of configuring a Spring-based server, which will enable you to interact with the application using your favorite web browser. You'll learn about all the magic that's going on the moment you enter a URL and hit the server with a page request. After you have served your first simple web page, you will delve into the details of writing web forms that can be used to submit data to the database.
In this chapter, the following topics are covered:
MVC concepts
Spring and MVC
Unit-testing of Spring controllers
Forms with Spring MVC
Validation with Spring
Exceptions with Spring MVC
The MVC Architectural Pattern
Before starting with the fun of building web pages, some background information on MVC and patterns will help you build easier-to-maintain and more scalable solutions. As developers build software, they are faced with problems that have been solved many times. Patterns are established by developers who have successfully solved these recurring problems in a consistent and successful way. Numerous books and articles have been written on the topic of patterns. Patterns have ...
Get Beginning Spring Framework 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.