Java Server Faces (JSF) is component-based framework that facilitates using HTML elements because you will not responsible anymore for writing parts of your HTML code

An example is to make a login page

we will start by making a bean represents our data
it will contain two properties represents the name and the password (two attributes, two setters and two getters )

also we’ll include a method that checks if that login details is valid or not
for simplicity we’ll choose a simple rule
if the name equals password then it’s correct login information
we can change this lines of code by what you want as for example connection to our database to check for these details

package beans;

public class User {

    private String name;
    private String pass;

    public void setName(String name) { = name;

    public void setPass(String pass) {
        this.pass = pass;

    public String getName() {
        return name;

    public String getPass() {
        return pass;

    public String check()
            return "welcome";
            return null;


there is something missing
till now it’s just a bean
we need to tell the framework that it’s a managed bean providing a name for it and a scope to be put into

Managed Bean
JSF framework uses some kind of beans called Managed Beans to store form data
so we will start to make our own ManagedBean