HOW TO ACCESS SESSION IN STRUTS 2 WITH EXAMPLE
Some of my friends are confused, how to deal with session in struts2, because struts 2 is Servlet API independent. We will try to understand all possible way to deal with session. You can obtain the session attributes by asking the ActionContext or implementing SessionAware. Implementing SessionAware is preferred. Using ActionContext: getContext() static method of ActionContext return instance of ActionContext, on which getSession() method is called which return Map of HttpSession value. Map attmap = ActionContext.getContext().getSession(); Now get(), put() and remove() method of Map is used for getting, putting and removing attribute in session scope.