Sometimes it is interesting to have the possibility of storing data in the session scope, this can be hard to maintain in the long run though. Therefore the bpm4struts allows you to nicely model the objects that are stored in session scope.
It's very simple, just model a new class and add the <<FrontEndSessionObject>> stereotype to it. Next, you will add attributes to that class, make sure all these attributes are public or you won't have any accessors generated for them.
Finally, just draw a dependency from any controller class to the session object, this will generate an accessor in the controller, so it's very easy to start using the session object (it will be created if it does not yet exist etc...).
A controller class may be dependent on more than one session object, and a session object may be shared between controller classes.
Taking the example from the image above you will see it is very easy to access the object in the session from within the controller, this is what is generated in the controller's abtract parent (generated JavaDoc information removed to improve readability):
The LoginSession will be a typical value-object but you will not need to worry about instantiating it and putting it in the session yourself, most of the time you will just want to get it from the session and store some attributes into it. Making sure the session no longer has any reference to the object is easy too: just call the corresponding remove method.
It is very easy to access the session object from within the JSP code, in our example it would be possible to simply do this: ${loginSession}. This will lookup an attribute in any scope, just remember the session object is stored using a name following the Java naming convention for variables (LoginSession.SESSION_KEY):
Next section: Security.