Posts tagged JSF

Dynamic breadcrumb / navigation menu


A breadcrumb / navigation menu should track all the moves of the user from a page to another

the concept of making a dynamic navigation menu is to save every visited page in a list so that it contains all the visited pages from the home page until the current page
when i click on any menu item (return to a previous page on my navigation) i should clear all the pages after this page from the list.

user visits history should be stored among all user requests and should be unique to every user, so we would store navigation information in Session scope


Hello JSF


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


Go to Top