We'll build a simple Spring web application with the following functionalities:
User registration
User login
We'll create the following three layers:
A data access layer to store and retrieve data
A service layer to perform business logic and data validation
Spring controllers to present the UIs and invoke services
In this section, we'll build the controllers and unit test them in isolation from the web server. We have to mock out the service and data access logic.
Perform the following steps to build the web application:
Create a dynamic web project,
SpringWeb
, and copy the Spring JARs from the Spring MVC project we created in Chapter 1, Getting Familiar with the Spring Framework.Add the following lines to the
web.xml
file in order to configure Spring MVC. We have already covered the details in Chapter 1, Getting Familiar with the Spring Framework:<web-app xmlns:xsi="..."> <display-name>SpringWeb</display-name> <servlet> <servlet-name...