I am trying following code When ever a user login I want to store his userid in application scope. like
Map application = ActionContext.getContext().getApplication();
Set<Long> logins = (Set<Long>) application.get("logins");
if (logins == null) {
application.put("logins", logins);
} else {
Set app = (Set<Long>) application.get("logins");
app.add(userid);
application.put("logins", app);
}
Set<Long> logins1 = (Set<Long>) application.get("logins");
for(long l:logins1){
System.out.println(" "+l);
}
and whenever user logged out I want to remove its id from application variable.
Problem above code is not working for my purpose how to achieve this?