I am working on a Web-application using JavaServer Faces.
I have found many examples and tutorials on how to use JavaServer Faces, but none of them actually explain what a Bean is used for. My initial thoughts were, that Beans represent forms. You enter data into your form and click the submit button and the associated Bean is filled with the data and a method is called.
However, so far I have only seen examples where there is one Bean per page, so a Bean could also represent a page and thus contain multiple forms.
I am also confused about the scope of a Bean. If the Bean represents a form or a page, it should become invalid after the request ended. If you make the bean live in the scope of the session, what happens to the Bean? Are you still able to somehow get the data out of it or will it just fill the associated form for you once you go back to it?
In summary - what is a Managed Bean and how do you use it properly?