Example

In the example there is a bean defined that, when created, stores the current time. It has a property called datum, Dutch for Date, that can be retrieved and which the timestamp of creation of the bean.

We the define 3 beans, one one request scope, one on session scope and one within our custom scope sfs . These beans are defined in the Spring Context as required by the 'framework'

We created 3 screens. Screen A and B where the timestamp of the 3 beans is displayed. There are also 2 links on the screens. One link stays on the same page, the other goes to the other page (A to B and B to A). The third screen, accesible from Screen B has none of the beans referenced and only a link to screen A.

If one clicks around in the application, one can see that

  • The value stored in the request bean changes by every click.
  • The value stored in the session bean never changes, as long as the browser window isn't closed.
  • The value stored in the the SFS scope changes only when we displayed the third screen where the bean isn't referenced..