jsf

1. What is JSF
        JavaServer Faces (JSF) is a new standard Java framework for building Web applications. It simplifies development by providing a component-centric approach to developing Java Web user interfaces.
        JavaServer Faces was officially proposed in March 2004, version 1.0, which clearly divided the developers of web applications into three roles: web designers, application designers, and UI component developers. From a usage point of view, web designers and application designers can develop programs in a way they are familiar with without invading each other's scope of work, while UI component developers can develop individual components independently, leaving the details to the for them to deal with.
        JSF also ensures that applications are more maintainable by integrating the well-established Model-View-Controller (MVC) design pattern into its architecture.
        Because JSF is a Java standard developed through the Java Community Process (JCP), development tool vendors are well positioned to provide JavaServer Faces with an easy-to-use, efficient, visual development environment.
2. The system of JSF
        One of the main strengths of JSF is that it is both a user interface standard for Java Web applications and a framework that strictly follows the Model-View-Controller (MVC) design pattern. The clean separation of user interface code (views) from application data and logic (models) makes JSF applications easier to manage. To prepare the JSF context that provides the page's access to application data and to prevent unauthorized or incorrect access to the page, all user interaction with the application is handled by a front-end FacesServlet (the controller).
                                                                         

 

3. The life cycle of JSF

        FacesServlet acts as the link between the user and the JSF application. It works within the scope of a well-defined JSF lifecycle that dictates the entire flow of events between user requests.

        a. When an event occurs on the JSF page (eg: the user clicks a button), the event notification is sent to the server via HTTP. The server uses a special servlet, FacesServet, to handle the notification.
        b.FacesServlet creates a FacesContext object (JSF context, which stores all the data of the application) as soon as it receives the user's request. In the processing process, the main modification is the FaceContext object.
        c. Then there is the processing process, the processor is an object called Lifecycle. FacesServet transfers control to the Lifecycle object. This object processes the FacesContext object in 6 stages to generate the response and finally sends the response back to the client.
        The series of actions required by the Lifecycle object to process a JSP request is called the request processing life cycle. The process state diagram is as follows:
                                                    (The picture is transferred from the Internet)

 

       Since the application request value, processing validation, updating model value, and calling application phases in the request processing lifecycle can add events to the FacesContext instance corresponding to the current request, the JSF implementation must process these events after these phases.
       Restore View: Find or create a component tree for the selected view. This phase is initiated as soon as the user clicks a link or button on the JSP page. JSP pages in a JSF application are represented as a tree of components. The JSF implementation further links these components to event handlers and validators, and saves the view in the FacesContext object for later processing. The FacesContext object contains all the state information that JSF needs to manage the state of the GUI components currently requested in the current session.
        Apply Request Value: Use the value sent in the request to update the component value of the component tree. Because the values ​​sent in the request are all of type String, these values ​​must be converted to the corresponding type before updating the component values ​​of the component tree. This process is also decoding. If there are errors in the conversion, these errors will be added to the FacesContext object.
        Processing validation: When the local value of each component is updated, the Lifecycle object will verify the validity of these values ​​according to the validation rules of these registered components. If the entered value does not meet the validation rules, a validation error is added to the FacesContext object and the component is marked as invalid. JSF will go to the render response phase and display the view with the validation error message. If no validation errors are encountered, JSF will proceed to the next stage.
        Update Model Values: Update the values ​​of backing beans (also called management beans) or model objects associated with the component. Only those bean properties that are bound with component values ​​will be updated.
        Calling the application: The JSF controller calls the application to handle application-level events, such as submitting a form. (Business logic can be executed at this stage)
        Rendering Response: Displays the selected view using current display technologies such as JSP.
1. What is JSF
        JavaServer Faces (JSF) is a new standard Java framework for building Web applications. It simplifies development by providing a component-centric approach to developing Java Web user interfaces.
        JavaServer Faces was officially proposed in March 2004, version 1.0, which clearly divided the developers of web applications into three roles: web designers, application designers, and UI component developers. From a usage point of view, web designers and application designers can develop programs in a way they are familiar with without invading each other's scope of work, while UI component developers can develop individual components independently, leaving the details to the for them to deal with.
        JSF also ensures that applications are more maintainable by integrating the well-established Model-View-Controller (MVC) design pattern into its architecture.
        Because JSF is a Java standard developed through the Java Community Process (JCP), development tool vendors are well positioned to provide JavaServer Faces with an easy-to-use, efficient, visual development environment.
2. The system of JSF
        One of the main strengths of JSF is that it is both a user interface standard for Java Web applications and a framework that strictly follows the Model-View-Controller (MVC) design pattern. The clean separation of user interface code (views) from application data and logic (models) makes JSF applications easier to manage. To prepare the JSF context that provides the page's access to application data and to prevent unauthorized or incorrect access to the page, all user interaction with the application is handled by a front-end FacesServlet (the controller).
                                                                         

 

3. The life cycle of JSF

        FacesServlet acts as the link between the user and the JSF application. It works within the scope of a well-defined JSF lifecycle that dictates the entire flow of events between user requests.

        a. When an event occurs on the JSF page (eg: the user clicks a button), the event notification is sent to the server via HTTP. The server uses a special servlet, FacesServet, to handle the notification.
        b.FacesServlet creates a FacesContext object (JSF context, which stores all the data of the application) as soon as it receives the user's request. In the processing process, the main modification is the FaceContext object.
        c. Then there is the processing process, the processor is an object called Lifecycle. FacesServet transfers control to the Lifecycle object. This object processes the FacesContext object in 6 stages to generate the response and finally sends the response back to the client.
        The series of actions required by the Lifecycle object to process a JSP request is called the request processing life cycle. The process state diagram is as follows:
                                                    (The picture is transferred from the Internet)

 

       Since the application request value, processing validation, updating model value, and calling application phases in the request processing lifecycle can add events to the FacesContext instance corresponding to the current request, the JSF implementation must process these events after these phases.
       Restore View: Find or create a component tree for the selected view. This phase is initiated as soon as the user clicks a link or button on the JSP page. JSP pages in a JSF application are represented as a tree of components. The JSF implementation further links these components to event handlers and validators, and saves the view in the FacesContext object for later processing. The FacesContext object contains all the state information that JSF needs to manage the state of the GUI components currently requested in the current session.
        Apply Request Value: Use the value sent in the request to update the component value of the component tree. Because the values ​​sent in the request are all of type String, these values ​​must be converted to the corresponding type before updating the component values ​​of the component tree. This process is also decoding. If there are errors in the conversion, these errors will be added to the FacesContext object.
        Processing validation: When the local value of each component is updated, the Lifecycle object will verify the validity of these values ​​according to the validation rules of these registered components. If the entered value does not meet the validation rules, a validation error is added to the FacesContext object and the component is marked as invalid. JSF will go to the render response phase and display the view with the validation error message. If no validation errors are encountered, JSF will proceed to the next stage.
        Update Model Values: Update the values ​​of backing beans (also called management beans) or model objects associated with the component. Only those bean properties that are bound with component values ​​will be updated.
        Calling the application: The JSF controller calls the application to handle application-level events, such as submitting a form. (Business logic can be executed at this stage)
        Rendering Response: Displays the selected view using current display technologies such as JSP.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325514328&siteId=291194637
jsf