Struts 2 - How to get session in an action class that do not implement SessionAware interface

Sometime, we are not interested to implement SessionAware interface to let Struts 2 framework auto set the session map. Here is how we can get the session map in struts 2 Action class. In your Struts 2 action's execute or some other method, you can get session map like this:
Map sessionMap = ServletActionContext.getContext().getSession();


Popular posts from this blog

Task 12 - Create Java Program with MySQL Database Connectivity

Java Interfaces and Exception Handling - Practice Problem with Solution

Task 16 - Javafx Program to Create, Retrieve, Update and Delete records with Database