0

I am trying to understand the life-cycle of JSF and I was reading through the following tutorial:

JSF tutorial

it says :

The view contains all the GUI components and there is a great deal of state management by JSF to track the status of the view – typically using HTML hidden fields.

I am confused that whether JSF Application keep that Managed bean's state during its interaction with the client is interacting, or it uses HTML hidden fields for the same, and mock a stateful bean.

Tiny
  • 27,221
  • 105
  • 339
  • 599
learner420
  • 190
  • 1
  • 6
  • 21
  • 1
    http://stackoverflow.com/q/5474316/1391249, http://stackoverflow.com/q/7349174/1391249, http://stackoverflow.com/q/4105439/1391249. – Tiny Jan 01 '15 at 09:35

1 Answers1

2

The term "JSF state" does not concern managed bean properties (the model values). It concerns the UI component properties, such as required, valid, immediate, disabled, readonly, rendered, etc. This is basically referenced by only one hidden input field and not multiple fields as that tutorial seems to imply. That hidden input field is the one with javax.faces.ViewState prefix in the name.

Technically, JSF managed beans are always stateful. Statefulness is expressed by whether or not having mutable instance variables. Javabeans are basically always mutable and thus stateful. JSF managed bean state is however not stored in the "JSF state". JSF managed beans are just stored in server's memory, usually as an attribute of the HTTP request, session or application.

See also:


Unrelated to the concrete problem, the tutorial you're reading is a JSF 1.x targeted one. JSF 2.x was introduced 5 years ago already. In case of developer tutorials, always pay attention to the publish date and also what version it treats. You can get started at our JSF wiki page.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • please i know that my question is out of this subject, but as i trust your recommandations, i want to know your opinion in using visual editors for JSF is a good practice or not? Thanks in advance – Tarik Jan 03 '15 at 20:25