There are two types of input validation you must consider in any application: syntactic and semantic validation. A form field value that represents a date, for instance, must be written in a certain format (i.e., be syntactically correct) in order to be interpreted by the application. It may also have to follow other rules (i.e., be semantically correct) to be accepted, e.g., be a date in the future or later than another date.
In JSF, components perform syntactic validation typically during the conversion from a request parameter string value to the native type of the business data property bound to the component. For semantic validation, you can attach validators to the components. JSF comes with a set of standard validators for the most common validation needs and lets you develop custom validators for more complex rules. We'll look at both alternatives in this chapter.
In Chapter 6, we created a few components, arranged them as a component tree in a view, rendered them to the browser, and saved the view state either in the response itself or on the server. Presumably, there's a user sitting there admiring our nice form with an input field and a button. Let's see what happens when she submits the form.
First, JSF must figure out which view to use for processing the request. This information is encoded in the URI itself. As you may recall from Chapter 6, we've decided to use the default extension mapping for ...