Why does JSF save component tree state?

前端 未结 2 1145
故里飘歌
故里飘歌 2020-12-07 17:53

There appears to be a difference between managed bean state and component tree state. You can control managed bean state by using annotations like @RequestScoped a

2条回答
  •  攒了一身酷
    2020-12-07 18:28

    Because the component tree can be altered programmatically depending on the initial request. This is not necessarily reproduceable on the subsequent request whenever the form data has to be processed.

    Further I have the impression that you think that the component tree also holds the model values. This is not true. It only holds references (by expression language) to the model values (the managed bean properties). The view state does not copy/duplicate/contain the model state. It's just a pure UI component tree. Perhaps your confusion is based on this. Note that the term "form data" is to be interpreted as submitted values and model values.

    See also:

    • Why JSF saves the state of UI components on server?

提交回复
热议问题