• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

[UserDispatchAction] retrieve attribute from servlet context

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).

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

Thanks in advance
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic