|
From: Cameron B. <ca...@da...> - 2004-03-09 15:04:26
|
I am going ahead and writing a Transformer anyway ;)
I'll post the code for you to look at when it is done.
One thing that your Configuration bean needs is :
At the end of ConfigurationFactory.initConfiguration()=20
this.configuration.setTemplateLoader(new ClassTemplateLoader());
Or.. You could allow spring configuration of template loadersm ;)
Cam
> -----Original Message-----
> From: spr...@li...=20
> [mailto:spr...@li...]
> On Behalf Of Cameron Braid
> Sent: Tuesday, 9 March 2004 11:41 PM
> To: spr...@li...
> Subject: RE: [Springframework-developer] FreeMarker
>=20
> Yeah.. The shared varible system works. Wrapping a map in a=20
> simple hash is the same technique that I have used elsewhere.=20
>=20
> For the time being I will only be using the=20
> ConfigurationFactoryBean, since I don't use Spring MVC.
>=20
> Are there plans to implement templates loading via the normal=20
> spring Resource system
>=20
> As well as something like a TransformerFactoryBean. I see=20
> something that provides bean property configuration of the=20
> initial context, the template location, and allows custom=20
> objects to be added to the context once the bean has been=20
> obtained from the context.
>=20
> This will make writing an email template system quite easy :
>=20
> <bean id=3D"feedbackTransformer"
> class=3D"spring.ui.freemarker.TransformerFactoryBean" =
singleton=3D"false">
> <property
> name=3D"templateLocation"><value>classpath:com/acme/feedback.ftl
> </value></prop
> erty>
> <!-- all properties of the context are entered into a=20
> simple hash -->
> <property name=3D"context">
> <map>etc...</map>=09
> </property>
> </bean>
>=20
> Then in your code you can do=20
>=20
> TransformerFactoryBean transformer =3D
> (TransformerFactoryBean)context.getBean("feedbackTransformer");
>=20
> transformer.addParam("name", model.getName());
>=20
> emailSender.send("fee...@ac...", "feedback",=20
> transformer.transform());
>=20
> I can certainly write this implementation if it could be=20
> included in spring, since I use something like it in my projects.
>=20
> The only issue is that I don't understand the spring resource system.
>=20
> I'll read about it you someone want me to implement this bean.
>=20
> Thanks,
>=20
> Cameron.
>=20
> > -----Original Message-----
> > From: spr...@li...
> > [mailto:spr...@li...]
> > On Behalf Of Darren Davison
> > Sent: Tuesday, 9 March 2004 11:03 PM
> > To: spr...@li...
> > Subject: RE: [Springframework-developer] FreeMarker
> >=20
> >=20
> > > Its me who is the doofus.. I didn't dig around enough to see the=20
> > > superclass !
> > >
> > > Sorry about that.
> >=20
> > no worries. Let us know how the current code meets your existing=20
> > needs; particularly whether your shared variables get exposed=20
> > correctly to the FreeMarker template. We can then decide=20
> whether to=20
> > add the stuff to the main source tree for 1.0-final (the FM=20
> guys are=20
> > planning to release
> > 2.3-RC1 any day now) or leave it in the sandbox until 1.1
> >=20
> > Cheers!
> >=20
> > --
> > Darren Davison
> > Public Key: http://www.davison.uk.net/key.jsp
> >=20
> >=20
> >=20
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux=20
> > tutorial presented by Daniel Robbins, President and CEO of GenToo=20
> > technologies. Learn everything from fundamentals to system=20
> > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dick
> > _______________________________________________
> > Springframework-developer mailing list=20
> > Spr...@li...
> >=20
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >=20
>=20
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials Free=20
> Linux tutorial presented by Daniel Robbins, President and CEO=20
> of GenToo technologies. Learn everything from fundamentals to=20
> system =
administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=3Dick
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
>=20
|