PDA

View Full Version : Access WebApplicationContext inside a ExtendedActionServlet


mickknutson
Aug 24th, 2005, 04:51 PM
I have an extended ActionServlet:

public class ExtendedActionServlet extends ActionServlet {


That I want to be able to get the WebApplicationContext from like I do in my DispatchActionSupport

I.e:

organization = ((AccessLdap)getWebApplicationContext().getBean ("accessLdap")).getUserOrganization(principal.getName());


How can I do this please?

joe.witt
Aug 24th, 2005, 09:17 PM
Since you're inside an ActionServlet you are inside a Servlet which means you have access to getServletContext() which means you can do:

ApplicationContext context = WebApplicationContextUtils.getApplicationContext(g etServletContext());

It's something like that or real close to it.