You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by João Vieira da Luz <jo...@gmail.com> on 2007/02/28 12:01:52 UTC

TypeConverter

Hi,

How can I access application context on a custom ognl.TypeConverter?

Thanks,
João

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] TypeConverter

Posted by cilquirm <aa...@gmail.com>.
I do it like so :

Map contextMap = ActionContext.getContext().getContextMap();

ApplicationContext applicationContext = (ApplicationContext) ((Map)
contextMap
						
.get("application")).get(org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
);


This I discovered using a bit of trail and error.
I'm not sure if there's a better way to retrieve the servlet context from a
TypeConverter, but if there was,
you'd be able to use WebApplicationContextUtils, from the spring api.




João Vieira da Luz wrote:
> 
> Hi,
> 
> How can I access application context on a custom ognl.TypeConverter?
> 
> Thanks,
> João
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/TypeConverter-tf3308136.html#a9208773
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org