This controller has a complex work flow, and we will break it down into its core compo-
nents. Then, we will show you the best extension points for altering the work flow in the
controller. We begin by illustrating all possible paths through the controller.
Figure 6-1 illustrates the many paths through the work flow of handling forms with
SimpleFormController.
Figure 6-1.SimpleFormController activity diagram
We will focus on the initial retrieval of the HTML form first. The controller uses the
method isFormSubmission()to determine if the HTTP request is either a form viewing or
form submission. The default implementation of this method merely checks the HTTP
method, and if it is a POST then isFormSubmission()returns true. The controller does not
consider a HTTP GET request a form submission. However, this method is not final, so your
implementation is free to define whatever criteria is appropriate to indicate the request
should be treated as a submission. If indeed the request is not a form submission, the
Resource requestedRetrieve form object from sessionEverything from AbstractController
Is a form submission?Yes Is a session form? YesIs form bean in session?YesCreate form objectCreate and init binderNo
Create NewForm objectCreate and init binderNo No
Remove from sessionBind request parameters to form objectBind to form objectStore form in sessionShould bind on NewForm?YesNo
Validate form objectYesonBindAndValidateValidate on bind? Suppress validation?
Yes NoNoYesCollect reference dataNoIs a session form?Display form view
No Handle form submit
Errors from binding or validation?
YesDoneCHAPTER 6 ■THE CONTROLLER MENAGERIE 151