PhotoAlbum Application Download Support Developer Guide
Skins:
Resources/Beans Handling
Ajax Miscellaneous
Usage
Usage Details

Rich Faces State API allows easily to define some set of states for the pages and any properties sets for these states.

Imagine one state as a set of named value-bindings method-bindings and some additional properties to be used after the state is activated. Hence you could define inputs values, controls labels and actions, rendering conditions and etc. using the same state variables which will have different values for every state.

The next small example panel has two states: login and register. Let's list the changes between login and register.

  • Confirmation field for password should appear in a register state
  • Method bindings should differ for the action button in every state
  • Value bindings for the fields could be different between states
  • Some labels should be changed between states

Also there should be a link which will switch states from login to register

Now try the example itself before further explanations.

Title
Login Existent User(To register)
username
password


Template Page


Initial wizard page(Page with EL bindings to state)


Logged in page


Registered page


Config Bean(States definition)


Bean(Stores login/register info)


Loginaction.java


Registeraction.java


faces-config beans definitions

Actually states are a map where the entry key is a name of the state and value is a state map. Particular state map has entries with some names as keys and any objects as values. Thus any value or method bindings or just simple state constants could be saved in State map.

Rich Faces state API implements states change as a standard JSF navigation. Action component should just return outcome, and our extension for JSF navigation handler will check whether this outcome is registered as state change outcome. If such state change outcome is found, the corresponding state will be activated and in other case, it will call standard navigation handling

There is step by step instructions telling how to configure Rich Faces states manager for existing JSF application in details tab.

RichFaces Wiki RichFaces Project Site