• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[UserDispatchAction] retrieve attribute from servlet context

 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
on a plugIn class I store a properties object in the servlet context, like this:
ServletContext context = servlet.getServletContext();
context.setAttribute(Constants.ROLES, roles);

the question is, why if I try to retrieve that object in this way from a DispatchAction, I get a null object
private Properties props = (Properties)servlet.getServletContext().getAttribute(Constants.ROLES);

while inside the method, like this, it works fine?
Properties roles = (Properties)request.getSession(false).
getServletContext().getAttribute(Constants.ROLES);

Can you tell me if this way will strongly affect the performance?

Thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic