In JSF, you do not code Controllers. Controllers are pre-written components of the JSF system itself. All you need to code is page View templates (xhtml) and backing beans (Models).
Another characteristic of JSF is that it is designed as much as possible to work with Plain Old
Java Objects (POJOs). That means that Backing Beans adhere to the structural conventions of generic JavaBeans. It also means that the need for JSF-specific coding is kept to a minimum. A good rule is that anytime you need to work with a javax.faces class or interface other than the model classes, you need to seriously consider whether you are doing it wrong. That includes the FacesContext. Except in very specialized cases, you definitely shouldn't be grabbing the JSF component tree and wrestling with it. Or, for that matter, the HTTPServletResponse object.
The operative model for JSF is to display a form and respond to postback requests from that form (Submits). JSF will validate the input control values from the form, and if they are each and every one of them valid, update the backing bean with those values and invoke the action method. The action method may then use this updated data to perform business functions and then return a navigation token to indicate the next form to be displayed. The postback functionality occurs when, for example, one or more control input values are invalid, in which case JSF will short-circuit the bean update and action method stages, stuff appropriate error messages into the JSF messages object, and re-display the page (along with the messages). This postback cycle reoccurs until the user has entered valid data.
AJAX (the JSF2 f:ajax tag) operates in a similar manner except that instead of submitting the entire form and rendering an entire page, you can narrow the input data (partial form submit) and be returned only partial output (partial page update). Instead of an action method, you invoke an AJAX listener method on the backing bean which operates similarly to an action method except that it has an optional ajax event parameter and does not return a navigation
string, since the same page continues to be displayed.
When you use the JSF ajax tag, you do not have to code any JavaScript of your own. The JSF framework ensures that the appropriate functionality is supplied to the displayed page both invisibly and transparently.