SLIDE 1
Handouts Apache MyFaces – Session
Slide 5 JSF is a new technology that enables you to create Java-based web apps. It is more than only a new framework/technology; it is a widely adopted industrial standard. Since JSF provides a clear lifecycle to process HTTP requests, it is much cleaner and simpler than JSP/Servlet based development. The lifecycle, for instance, takes care of extracting request parameters and copies them to a corresponding JavaBean class. JSF enables you to uses POJO (Plain Old Java Objects) during your development process. Those classes are called backing beans. So there is no need to extend framework classes or implement special interfaces. It’s up to you if your class needs to inherit by a class of your domain specific framework or not. JSF provides a set of user interfaces components (UI components) that are itself JavaBeans with special properties. The concept behind the UI components is similar to that what is known by classic GUI frameworks like Swing. Since JSF focuses on web development it provides no fat client components. Instead it ships some generic components like UIInput
- r UIOutput. It additionally provides some components that have special HTML properties
like HtmlSecret or HtmlTextArea extending the generic UIInput component. For adding new behaviour to the framework components, you could provide a custom component that extends some of the generic or standard HTML components. Since the UI components are standard JavaBeans they need to take care of their rendering. It is possible that a component renders itself or better that it delegates the rendering to a special class called
- Renderer. A set of Renderer classes is called RenderKit. The JSF standard says that
each implementation must contain at least a RenderKit for HTML 4.0.1. But it is possible to create a custom RenderKit. Another interesting point is that JSF is able to handle events that are generated from the web GUI (the UI components). There are currently two concrete events (ActionEvent and ValueChangedEvent). Similar to the event concept in the JavaBean standard, JSF provides Listeners for each event. And again, it is possible to create custom events, since the two concrete event classes extend the abstract FacesEvent class, which is itself a specialization of the java.util.EventObject. Beyond these possibilities, you can call your back-end data by special Command components like HtmlCommandButton or HtmlCommandLink. These command components are used during the workflow process to present pages to the browser. For its management of managed-beans, JSF uses the dependency injection pattern that is know from lightweight IoC containers like Spring or Hivemind. It uses one special dependency injection pattern, the setter injection pattern. With the usage of setter injection it is possible to preconfigure properties of your backing beans. Additional to backing beans the “Managed Bean Facility” of JSF can also initialize and create other objects like DAO
- bjects, for instance.