img
As shown in Listing 17-26, the logical view name is mapped to the corresponding body attribute of
the view to display. As in the ContactController class in Listing 17-11, the list() method returns the
logical view name contacts/list, so Tiles will be able to map the view name to the correct template and
the view body to display.
We can now test the page. Make sure that the project was rebuilt and deployed to the server. Load
the contact list view again (http://localhost:8080/ch17/contacts), and the view based on the template
will be displayed, like the one shown in Figure 17-10.
Figure 17-10. Contact list view with Apache Tiles
Implement the Views for Contact Information
Now we can proceed to implement the views that allow users to view the details of a contact, create new
contacts, or update existing contact information.
In the following sections, we will discuss the mapping of URLs to the various views, as well as how
the views are implemented. We will also discuss how to enable JSR-303 validation support in Spring
MVC for the edit view.
Mapping of URLs to the Views
First we need to design how the various URLs are to be mapped to the corresponding views. In Spring
MVC, one of the best practices is to follow the RESTful-style URL for mapping views. Table 17-5 shows
the URLs-to-views mapping, as well as the controller method name that will handle the action.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home