Well, I have made a little more progress.. We can define a 'constant' element like - <constant name="myVal" value="x" />
Then that can be injected in to the bean property using @Inject annotation. The only issue is that the setter for the property has to accept a String value, and then convert into the required type. This is actually good enough for what I was trying to do, which was to use the Struts' built in DI facilities for very simple cases. Still, if anyone knows how I can avoid doing the type conversion myself, that would be great. Cheers, Sonny On Thu, Feb 12, 2009 at 1:19 PM, Sonny Gill <sonny.pub...@gmail.com> wrote: > Hi guys, > > I am trying to find out if it is possible to do some basic DI using > the native DI support in Struts 2. > > I can create a bean in struts.xml as - > > <bean name="beanName" type="com.MyInterface" class="com.MyImpl" /> > > and have it injected into my Action using - > > @Inject( "beanName" ) > > Is there a way to pass a primitive or String value to the bean > beanName created using the <bean /> element? > > Say something like - > <bean name="beanName" type="com.MyInterface" class="com.MyImpl" > > <property><name>myString</name><value>Abc</value> > </bean> > > > Cheers, > Sonny --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org