Scope types

There are four scope types available until now: Logic, Request, Session and Application.

ScopeType.REQUEST

This scope is a wrapper for the Request scope. It lives until the user receives the response.

It is the defaults scope

You can access the RequestContext object through dependency injection.

It can also be used with dependency injection:

public class MyLogic {

        private RequestContext reference;

        public MyLogic(RequestContext reference) {
                this.reference = reference;
        }

}

ScopeType.SESSION

This scope is a wrapper for the Session scope. It lives until the session expires (see Session Timeout on the servlet specification).

ScopeType.APPLICATION

This scope accesses the servlet context a.k.a. application scope.

ScopeType.FLASH

This is a special scope. It lives until the end of the next request. Very useful for view redirection, when we want to maintain parameters during this redirection.

If you have in your views.properties:

myComponent.myLogic.ok = redirect:otherComponent.otherLogic.logic

flash scope variables will remain in otherComponent.otherLogic, while request scope variables won't.