img
Table 17-5. Mapping of URLs to Views
URL
HTTP
Controller Method
Description
Method
GET
List the contact information.
/contacts
list()
GET
Display a single contact's information.
/contacts/{id}
show()
GET
Display the edit form for updating an
/contacts/{id}?form
updateForm()
existing contact.
POST
Users update the contact information
/contacts/{id}?form
update()
and submit the form. Data will be
processed here.
GET
Display the edit form for creating a new
/contacts?form
createForm()
contact.
POST
Users enter contact information and
/contacts?form
create()
submit the form. Data will be processed
here.
GET
Download the photo of a contact.
/contacts/photo/{id}
downloadPhoto()
Implementing the Show Contact View
Now we implement the view for showing a contact's information. Implementing the show view is a
three-step process:
Implement the controller method.
1.
Implement the show contact view (/views/contacts/show.jspx).
2.
Modify the view definition file for the view (/views/contacts/views.xml).
3.
Listing 17-27 shows the show() method implementation of the ContactController class for
displaying a contact's information.
Listing 17-27. The show() Method of the ContactController Class
package com.apress.prospring3.ch17.web.controller;
// Import statements omitted
@RequestMapping("/contacts")
@Controller
public class ContactController {
// Other code omitted
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home