protected void doSubmitAction(Object command) throws Exception {
Person person = (Person) command;
// persist the object, or some other business logic
}
}
The bornOnparameter of the Personobject is of type java.util.Date, so we are required
to use a custom PropertyEditorto convert the string parameter into a true Dateobject. This
Controllerrelies on the default behavior of forwarding to the successViewonce the form is
submitted, so we chose to implement doSubmitAction()because it requires the least amount
of code.
By default, the form bean will placed into the model on successful form submission.
Therefore, the form success view can access the form bean with the identifier set via
setCommandName(). The following XHTML page (Listing 6-43) shows this in action.
Listing 6-43.newPersonSuccess XHTML Page
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
${person}
Listing 6-43’s JSP page will render the following result to the browser (Figure 6-4).
Figure 6-4.Form success view
CHAPTER 6 ■THE CONTROLLER MENAGERIE 159