For more information about JSF, see the following link:
Http://www-128.ibm.com/developerworks/library/j-jsf1/
Http://www.fawcette.com/javapro/2004_01/magazine/features/cschalk/
The following link explains how to build a custom JSF component:
Http://www.theserverside.com/articles/article.tss? L = buildingcustomjsf
Of course, this book may be a good way to learn more about JSF. Mastering JavaServer faces will give you a deeper understanding of the JSF architecture and its applications.
Author: Chris schalk, Oracle Corporation
April 2005
What is JSF?
JavaServer faces (JSF) is a new standard Java framework used to build Web applications. It provides a component-centric method for developing Java Web user interfaces, which simplifies development. JavaServer faces has also aroused the interest of Java/Web developers. "Enterprise developers" and web designers will find that JSF development can be simple by dragging and dropping User Interface (UI) components to the page, system developers will find that the rich and robust JSF APIs provide them with unparalleled functionality and programming flexibility. JSF also ensures higher maintainability of applications by integrating well-built Model-View-controller (MVC) design patterns into its architecture. Finally, because JSF is a Java standard developed through Java Community process (JCP), the development tool vendor is fully able to provide an easy-to-use and efficient visual development environment for JavaServer faces.
JSF architecture: MVC implementation of JavaServer faces
One of the main advantages of JSF is that it is not only a Java Web user interface standard, but also a framework that strictly follows the Model-View-controller (MVC) design pattern. User Interface code (View) And Application Data and logic (Model) To make JSF applications easier to manage. To prepare the JSF context that provides page access to application data and prevent unauthorized or incorrect access to the page, all user interactions with the application are performed by a front-end "Faces" servlet (Controller.
Figure 1: MVC implementation of JavaServer faces
JSF Lifecycle
The faces controller servlet acts as a bond between users and JSF applications. It isJSF Lifecycle(Specifies the entire event stream between user requests. For example, after receiving an initial Web request to access the JSF application, the faces controller servlet processes the request by preparing the JSF context (a Java object that stores all application data. The Controller then directs the user to the requested page. This page usually uses a simple expression language to process application data from the JSF context. When a subsequent request is received, the Controller updates all model data (assuming new data is input ). JSF developers can access the entire JSF lifecycle at any time during the application running, so that they can control the behavior of the application at any time.
JavaServer faces User Interface Component
The real power of JavaServer faces lies in its user interface component model. In this model, the application is fully built with a set of components, which can be displayed in different ways for multiple client types. And other proprietary technologies (such as ASP. net). JSF's UI component model technology allows developers to use pre-built User Interface (UI) components to build a web user interface (rather than building a user interface from scratch ), this provides unprecedented development efficiency. The jsf ui component has multiple forms, which can be as simple as displaying text.OutputlabelOr, it can be complicated to indicate the tabular data from a data set (such as a database table ).Datatable.
The assumerver faces specification provides a set of basic UI components in its reference implementation, which are very useful. They include two component libraries, namely the "html" Component Library-most of which map standard HTML input elements; and the "core" library-which assists with common application development tasks (such, internationalization and validation/conversion of input data ). In addition to providing a basic UI Component Library, the jsf api also provides the ability to expand and create custom jsf ui components to provide more functions on the basic components.
Other User Interface Component Libraries
Due to the richness and flexibility of JSF APIs, many Java developers began to create new JSF Component Libraries and implementations. OracleADF facesIs a component library that fully complies with JSF specifications. It provides a wide set of enhanced UI components for JSF application development. These components include a variety of Renderer, advanced table, color and date selector for each client type, and a large number of common components (such as menus, command buttons, Transfer Selector, and progress indicator ).
Figure 2: Oracle's ADF faces jsf ui component
In addition to Oracle's ADF faces, there are other new JSF Component Libraries starting from the open source and software vendor communities.MyFacesIs an example of a new jsf ui component library, which is provided by Apache as an open source project. MyFaces also enhances the basic UI components of JSF. It has a wider range of UI functions, such as integrated tiles support, menus and tree controls that support JavaScript.
Figure 3: open-source MyFaces implementation and UI Component Library
Insert rendering technology of jsf ui Components
One of the most striking aspects of jsf ui component technology is its pluggable rendering function. The jsf ui component can present itself in different ways based on the client type of the component. For example, the HTML browser will see the "HTML browser-friendly" version of a specific UI component, while the micro devices that support wireless or WAP will seeSameThe "WML-friendly" version of the UI component! By decoupling the UI component from its rendering logic, JSF can create multiple Renderer for the same UI component to implement this function. Different Renderer can be associated with the UI component. At runtime, the UI component can decide which Renderer to use based on the client type of the request.
Figure 5: An ADF faces table component is presented differently for wireless clients and HTML clients.
It should also be noted that the jsf ui component can display any type of data, whether it is labeled data (such as HTML, XML, WML, etc.) because of JSF's pluggable rendering function) or binary data. For example, the UI component can also display binary data, such as a stream or different document types, such as SVG, PDF, and word.
A new JSF component developer community
As the community of JSF developers and advocates continues to grow, several websites are dedicated to further promoting independent JSF development.JsfcentralIs a new website that fully serves the JSF development community. It contains JSF technical information, product/component information, and a large number of articles related to JSF.
Figure 4: jsfcentral-a free JavaServer faces community
(Jsfcentral address is: http://jsfcentral.com) JSF development tools
Because assumerver faces is a standard Java technology, software development tools can provide advanced integrated development tool support for JavaServer faces. Multiple Vendors now support JSF development to varying degrees, which greatly improves the ease of use and functionality of JSF. Oracle, sun, Borland, and IBM provide development environments for the assumerver faces. Development Tool vendors are competing to provide better, simpler, and more development environments, so ide-based JSF development has a bright future!
Figure 6: Oracle's jdeveloper provides an efficient and visualized JSF development experience
Summary
Assumerver faces provides a concise implementation of the Model-View-controller design mode, while providing efficient component-centric development without sacrificing development capabilities and flexibility, solved many historical issues in Java Web development. In addition, because JSF is a Java standard, multiple software vendors will continue to provide an efficient development environment, these development environments will undoubtedly reach or are likely to exceed the proprietary visual development environment. Please stay tuned!