<snip> But, fact is that when I want to get my component from servletcontext I have to cast it to my proper type. Is there a way to avoid that? </snip>
Not really, but you could create a static (or non static if you like) helper method somewhere to take care of both remembering the key and casting: public class MyComponentFinder { public static final MyComponent getMyComponent(ServletContext sc) { return (MyComponent)sc.getATtribute(MY_COMPONENT_KEY); } } -----Original Message----- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Wednesday, 31 March 2004 23:02 To: 'Struts Users Mailing List' Subject: Struts and plugin question Hi all, I was wondering something about plugIns. Let's say, I want to create an object that has application context. So I create a plugIn to initialize it and store it in ServletContext. But, fact is that when I want to get my component from servletcontext I have to cast it to my proper type. Is there a way to avoid that? Just for some brainstorming.... Thanx in advance to all the replies Regards marco --------------------------------------------------------------------- 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]