runtime that it's a JSF converter. The attribute defined within the annotation is the ID of the converter.
We will see how to use it when we implement the list contact view.
Implementing the Controller and Backing Bean
The next step is to implement the controller class, as well as the backing bean for the list contact view.
First let's implement the backing bean, the ContactListBean class. This class is used to store the list
of contacts, as well as the selected contact when a user clicks a row in the data table. Listing 18-8 shows
its content.
Listing 18-8. The ContactListBean Class
package com.apress.prospring3.ch18.web.view;
import java.io.Serializable;
import java.util.List;
import com.apress.prospring3.ch18.domain.Contact;
public class ContactListBean implements Serializable {
private List<Contact> contacts;
private Contact selectedContact;
// Getter/setter methods omitted
}
The bean is a simple POJO bean, with the attributes to store the list of retrieved contacts and the
contact selected by the user in the frontend. Note that the backing bean should implement the
Serializable interface.
Listing 18-9 shows the ContactController class.
Listing 18-9. The ContactController Class
package com.apress.prospring3.ch18.web.controller;
import
org.slf4j.Logger;
import
org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component;
import com.apress.prospring3.ch18.service.ContactService;
import com.apress.prospring3.ch18.web.view.ContactListBean;
@Component("contactController")
public class ContactController {
private static final Logger logger = LoggerFactory.getLogger(ContactController.class);
@Autowired
private ContactService contactService;
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home