I might be missing the point here. But why do you want to get hold of an application contect directly? You just want to pull out beans from it to use in your actions? You would be much better off using the Struts 2 Spring integration to have it populate your actions for you. No messy util classes pulling things in. Just put the setters on your action and let them be wired in.
http://cwiki.apache.org/WW/spring-plugin.html Martin. ----- Original message ----- From: "Zarar Siddiqi" <[EMAIL PROTECTED]> To: user@struts.apache.org Date: Sun, 24 Jun 2007 12:02:30 -0700 (PDT) Subject: Re: [S2] + Spring - WebApplicationContext? That'll work but if you want to use one line to get it, use this: http://www.springframework.org/docs/api/org/springframework/web/context/support/WebApplicationContextUtils.html#getRequiredWebApplicationContext(javax.servlet.ServletContext) WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext) Zarar Shibing.Chen wrote: > > Let your Action implements ApplicationContextAware interface. > > On 6/22/07, Paul <[EMAIL PROTECTED]> wrote: >> Probably a dumb question but does anyone have an example of the best way >> of obtaining the web application context within a Struts 2 action? >> >> I need to lookup and get a bean that I've configured in my spring >> context. >> >> Thanks in advance! >> Regards, >> Paul > > > -- > Think different. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-S2--%2B-Spring---WebApplicationContext--tf3965475.html#a11277442 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]