I already answered the same in your previous question. You can use any method or you can even access the session in other ways.
one way
Map attibutes = ActionContext.getContext().getSession();
But if you use this and your action class is directly tied to an ActionContext , which is ActionContext 's special way. One of the main goals of Struts2 is to disable Action classes from the main HTTP context, as well as with other direct dependencies. Also writing test cases for a simple POJO is easier and better than in another.
By implementing the SessionAware interface, you SessionAware that you want the session to be a simple map object, it not only makes the code very loose, but it is easy to maintain and test.
I hope someone else comes along with better points on this
source share