I followed many examples on how to use SessionAware
in a Struts 2 project and I always get a NullPointerException
when I want to put data in the session. Why?
public class UserService extends ActionSupport implements SessionAware {
private Map<String,Object> sessionmap;
@Override
public void setSession(Map<String, Object> sessionmap) {
this.sessionmap = sessionmap;
}
public String execute() {
sessionmap.put("id", iduser);
return SUCCESS;
}