File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes [UserDispatchAction] retrieve attribute from servlet context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "[UserDispatchAction] retrieve attribute from servlet context" Watch "[UserDispatchAction] retrieve attribute from servlet context" New topic
Author

[UserDispatchAction] retrieve attribute from servlet context

Alessandro Ilardo
Ranch Hand

Joined: Dec 23, 2005
Posts: 218
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


trying to decode a woman mind....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [UserDispatchAction] retrieve attribute from servlet context