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.
This article describes JSF. First, let's give readers a brief introduction to JSF: JSF is a java web standard and may replace the jsp era. JSF is the user interface framework of Java Web applications.
JSF provides a set of APIs and tag libraries for creating Page forms and complex interface elements.
JSF makes it easier to compile the code for form submission. The code can respond to different button submissions, change some values or select some users.
◆ Managed beans: This simplifies JSF's method for processing request parameters.
◆ EL (Expression Language): JSF has a set of Expression languages for accessing java bean attributes and set elements.
◆ Form field type conversion and verification
◆ Special attributes
◆ UI Component Model
JSF provides a set of flexible component models, including:
◆ A set of UIComponent classes that define the status and behavior of the UI component.
◆ Rendering model: defines how to present components in different ways
◆ Event and listener models are used to process component events.
◆ Conversion model: convert data
◆ Verification Model: How to verify the validity of data
Getting started with JSF: Data Conversion Model
When a component is bound to an object, there are two views for component data:
One is the model view: From this perspective, the data is represented by the java object type, such as int, long, Date, and so on.
One is to present the view: From this perspective, the data is expressed as a form that can be read or modified by people. For example, a Date type may be displayed as a string in the yyyy-MM-dd format, or three strings, representing the year, month, and day.
You can define your own converter to convert data.
JSF Introduction: event and listener Model
Event: value change event, Action event, and data model event.
Value Change: for example, the value of the input box is changed and the checkbox is selected.
Action event: click a button or hyperlink
Data Model event: this event is triggered when a row of the UIData component is selected.
JSF entry: navigation model
Navigation-rule, which can contain one from-view-id and multiple navigation-Cases
Each navigation-case mainly includes the page for turning.
From-view-id: Current page
From-action: From which action Method
From-outcome: Logical name From
To-view-id: To which page
The problem solved by navigation is: from where to where. In a word: from the from-view-id page, when the from-action method is called and its return value is from-outcome, it is switched to the to-view-id page.