Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed ../apidocs/ links

...

A field holding an SSO is marked with the SessionState annotation.

Example:

Code Block
java
java
public class MyPage
{
  @SessionState
  private MyState myState;
  
  . . .
}

...

Alternately, you will configure an SSO so that you can control how it is instantiated. You may need to inject some values into the SSO when it is first created, or otherwise initialize it. In this second case, you may provide an ApplicationStateCreator object, which will be called upon to create the SSO as necessary. This is also the technique to use when you want your SSO to be represented by an interface rather than a class: you need to provide a creator that knows about the class that implements the interface.

...

Our creator creates a new MyState instance using an alternate constructor that takes the current date and time. Again, just an example.

Finally, we create an ApplicationStateContribution identifying the strategy name and the creator, and give that to the configuration.

...