@Persist

Target: Any attribute annotated with @Parameter.

Description: Defines the kind of persistence of a parameter. By default, the parameters have request scope assigned.

JavaDoc: Click here

Attributes:

Name Description Data type Required Default value
scope Defines the parameter scope. See note on scopes below. ParameterScope No ParameterScope.REQUEST
repository Controls if the parameter value will be stored on an external repository. boolean No False
allowAnonymous Controls if the parameter value can be accessed by non-authenticated user. If T null is returned and a warn is issued. If F will raise an exception. Only valid for USER-scoped parameters. boolean No False

Example:

public class aStage {

 @Parameter(defaultValue="30")
 @Persist(scope=ParameterScope.SESSION, repository=true)
 Integer myIntegerParam;

 @Parameter(constraints="numeric, maxvalue=100")
 @Persist(scope=ParameterScope.USER, allowAnonymous=true)
 String myStringParam;
 ...
}

Scope values: All scopes are defined by the ParameterScope enumeration.

Possible values:

  • REQUEST: Parameter value will persist only during the request execution and for the current session.
  • SESSION: Parameter value will persist during the current session of the current user.
  • USER: Parameter value will persist between sessions of a given user.
  • STATIC: Parameter value will be seen by different sessions of different users.

See also:

Back to annotation reference