1
votes

Hy,

I have been reading about the concept of component tree state in JSF but I still dont get it. I mean, I have read that this component tree is a data structure but when I see classes like UIForm, UIinput I dont undertand why these classes are used and what for?

  1. This component tree is used to store the values of a form submitted? I think is not because theses values are hold in the model beans,so what is the utility of this component tree?

    2 . This component tree stores visual information or logical information? I mean, because I see classes like UIForm, it seems that a html form is represented in the server but I dont know if this component tree stores visual information(width, lenght of a div....) on this component tree or just validators, conversors, inputs... of a html form.

  2. This component tree is used to create an "image" of a form submitted because for example
    if the user press back in the browser it will get the form with their values as it was submitted?

Thanks

1

1 Answers

1
votes

1) The components are the ones defined in your XHTML page.

2) When a request is processed, the "text" XML is "compiled" in the component tree. That way, JSF can know that the input value "myTable:2:name=Mike" is the "name" field of the third row of the myTable table. And also will learn that this value is mapped to the firstName property of the third item of the employees properties of your model bean.

3) If everything is ok (data types, converters, validators...), with the data of the tree the model is updated at a later stage (I think it is 4, but check the JSF lifecycle anyway).

4) When the HTML is generated, the component tree is explored so that each component draws the HTML related to its rendering.