|
From: Darren D. <da...@da...> - 2004-03-03 11:02:21
|
for info: I've added FreeMarker integration to my local sources along very similar lines to the Velocity code. It's working well at home in an existing Velocity project that's had its templates migrated to FTL. Should be ready to commit after 1.0-final, ready for 1.1-m1 If there's anyone who makes heavy use of FreeMarker currently (I believe Cameron said he did?), could you let me know which features you're employing - particularly where it pertains to Configuration objects (http://freemarker.sourceforge.net/docs/api/freemarker/template/Configura= tion.html)? FM has a non-bean-friendly interface into much of the API and I'd like t= o ensure that I get this integration meeting existing needs early on. Cheers, --=20 Darren Davison Public Key: http://www.davison.uk.net/key.jsp |
|
From: Darren D. <da...@da...> - 2004-03-03 11:03:12
|
(sorry if this is a dupe - problems here with my webmail) for info: I've added FreeMarker integration to my local sources along very similar lines to the Velocity code. It's working well at home in an existing Velocity project that's had its templates migrated to FTL. Should be ready to commit after 1.0-final, ready for 1.1-m1 If there's anyone who makes heavy use of FreeMarker currently (I believe Cameron said he did?), could you let me know which features you're employing - particularly where it pertains to Configuration objects (http://freemarker.sourceforge.net/docs/api/freemarker/template/Configura= tion.html)? FM has a non-bean-friendly interface into much of the API and I'd like t= o ensure that I get this integration meeting existing needs early on. Cheers, --=20 Darren Davison Public Key: http://www.davison.uk.net/key.jsp |
|
From: Cameron B. <ca...@da...> - 2004-03-03 11:24:31
|
Darren, Yeah I make heavy usage of freemarker. Are you still using the FreemarkerServlet ? my requirements for Configuration are pretty simple at the moment, within a subclass of FreemarkerServlet : createConfiguration() - I run configuration.setSharedVariable a few times to add=20 - converter utils - formatter utils - money utils - an ognl tool - an enum template model (to allow me to access hibernate persistent string enums) protected boolean preTemplateProcess( HttpServletRequest request, HttpServletResponse response, Template template, TemplateModel templateModel) - I add some request scoped components - browser identifyer tool - url generating tool like the velocity link tool (depends on request) - toolbox - custom url generation for things like actions, jsessionid encoding, http/https changing etc.. protected ObjectWrapper createObjectWrapper()=09 - I configure the BeansWrapper with .setSimpleMapWrapper(true); I also use freemarker for generation of emails, without using the freemarker servlet To do this I just add some beans into a map (the toolbox and other utils above) and call template.process(nmap, stringWriter); I am keen to look at the code that you have prepared, especially since it will be added into spring after 1.0 final. Can you sent it to me ? Thanks, Cameron. > -----Original Message----- > From: spr...@li...=20 > [mailto:spr...@li...] > On Behalf Of Darren Davison > Sent: Wednesday, 3 March 2004 8:50 PM > To: spr...@li... > Subject: [Springframework-developer] FreeMarker >=20 > (sorry if this is a dupe - problems here with my webmail) >=20 > for info: >=20 > I've added FreeMarker integration to my local sources along=20 > very similar lines to the Velocity code. It's working well=20 > at home in an existing Velocity project that's had its=20 > templates migrated to FTL. Should be ready to commit after=20 > 1.0-final, ready for 1.1-m1 >=20 > If there's anyone who makes heavy use of FreeMarker currently=20 > (I believe Cameron said he did?), could you let me know which=20 > features you're employing - particularly where it pertains to=20 > Configuration objects=20 > (http://freemarker.sourceforge.net/docs/api/freemarker/templat > e/Configuration.html)? > FM has a non-bean-friendly interface into much of the API=20 > and I'd like to ensure that I get this integration meeting=20 > existing needs early on. >=20 > Cheers, > -- > Darren Davison > Public Key: http://www.davison.uk.net/key.jsp >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer >=20 >=20 |
|
From: Darren D. <da...@da...> - 2004-03-03 12:18:23
|
> Are you still using the FreemarkerServlet ? no, the MVC part includes FreemarkerView with similar semantics to VelocityView whereby it is able to retrieve a freemarker.template.Configuration object at initialization. > my requirements for Configuration are pretty simple at the moment, > within a subclass of FreemarkerServlet : > > createConfiguration() - I run configuration.setSharedVariable a few > times to add > - converter utils > - formatter utils > - money utils > - an ognl tool > - an enum template model (to allow me to access hibernate > persistent string enums) I'll look into this a little closer. setSharedVariable() and it's cousin setSetting() (??) are examples of the quirky configuration in FM. I've sent mail to one of the FM developers to see if they're amenable to streamlining their API slightly. > protected boolean preTemplateProcess( > HttpServletRequest request, > HttpServletResponse response, > Template template, > TemplateModel templateModel) > - I add some request scoped components > - browser identifyer tool > - url generating tool like the velocity link tool (depends > on request) > - toolbox - custom url generation for things like actions, > jsessionid encoding, http/https changing etc.. I guess these could be added to the Spring model Map in your controller code (possibly as reference data or even via an Interceptor) ? > I also use freemarker for generation of emails, without using the > freemarker servlet > > To do this I just add some beans into a map (the toolbox and other > utils above) and call template.process(nmap, stringWriter); similar will be available through the non-servlet ui components (again, see the Spring-Velocity javadocs) > I am keen to look at the code that you have prepared, especially > since it will be added into spring after 1.0 final. > Can you sent it to me ? yes, but give me a couple of days :) Thanks for the input. --=20 Darren Davison Public Key: http://www.davison.uk.net/key.jsp |
|
From: Darren D. <da...@da...> - 2004-03-05 20:26:43
|
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've committed freemarker ui and view components to the sandbox as there ar=
e=20
a couple of things still outstanding to do, and they're not fully tested.
Cameron - if you're able to take a look and see if you can get the shared=20
variables aspect working in your project that would be helpful.
Specify a FreemarkerConfig bean in your servlet context file like so;
<!-- freemarker config -->
<bean=20
id=3D"freemarkerConfig"
class=3D"org.springfr...view.freemarker.FreemarkerConfigurer"
<!-- optional -->
<property name=3D"freemarkerSettings">
<props>
<prop key=3D"localized_lookup">true</prop>
<!-- etc... -->
</props>
</property>
<!-- optional -->
<map name=3D"freemarkerVariables">
<entry key=3D"my_helper">
<ref local=3D"freemarkerHelperObject"/>
</entry>
<!-- etc... -->
</map>
</bean>
and similar to the following to define a view;
fmView.class=3Dorg.springframework.web.servlet.view.freemarker.FreemarkerVi=
ew
# if you don't specify a templateContext, WEB-INF/freemarker will be
# searched for templates
fmView.templateContext=3DWEB-INF/ftl
fmView.url=3Dtest.ftl
=2D --=20
Darren Davison
Public Key: http://www.davison.uk.net/key.jsp
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFASN8IKLMLAN01aw0RAqClAJ4pPlH0MaHWvp2TPxk4j3/T6J3rqwCdG4ny
DOuc/+gNCQrVqZdPuFB7Ug0=3D
=3DpFHR
=2D----END PGP SIGNATURE-----
|
|
From: Cameron B. <ca...@da...> - 2004-03-09 07:45:23
|
I havn't done any real integration with the sandbox code, but one = suggestion that I can make is to move the core freemarker configuration classes = from web into somewhere else, sice its not just a web technology. I use freemarker for email generation as well as views. I would presume that the same can be said and done for velocity, even = xslt etc.. Cameron > -----Original Message----- > From: spr...@li...=20 > [mailto:spr...@li...] > On Behalf Of Darren Davison > Sent: Saturday, 6 March 2004 6:12 AM > To: spr...@li... > Subject: [Springframework-developer] FreeMarker >=20 > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 > I've committed freemarker ui and view components to the=20 > sandbox as there are a couple of things still outstanding to=20 > do, and they're not fully tested. >=20 > Cameron - if you're able to take a look and see if you can=20 > get the shared variables aspect working in your project that=20 > would be helpful. >=20 > Specify a FreemarkerConfig bean in your servlet context file like so; >=20 > <!-- freemarker config --> > <bean > id=3D"freemarkerConfig" > class=3D"org.springfr...view.freemarker.FreemarkerConfigurer" >=20 > <!-- optional --> > <property name=3D"freemarkerSettings"> > <props> > <prop key=3D"localized_lookup">true</prop> > <!-- etc... --> > </props> > </property> >=20 > <!-- optional --> > <map name=3D"freemarkerVariables"> > <entry key=3D"my_helper"> > <ref local=3D"freemarkerHelperObject"/> > </entry> > <!-- etc... --> > </map> > </bean> >=20 >=20 >=20 > and similar to the following to define a view; >=20 > fmView.class=3Dorg.springframework.web.servlet.view.freemarker.F > reemarkerView > # if you don't specify a templateContext, WEB-INF/freemarker=20 > will be # searched for templates fmView.templateContext=3DWEB-INF/ftl > fmView.url=3Dtest.ftl >=20 >=20 >=20 > - --=20 >=20 > Darren Davison > Public Key: http://www.davison.uk.net/key.jsp -----BEGIN PGP=20 > SIGNATURE----- > Version: GnuPG v1.2.4 (GNU/Linux) >=20 > iD8DBQFASN8IKLMLAN01aw0RAqClAJ4pPlH0MaHWvp2TPxk4j3/T6J3rqwCdG4ny > DOuc/+gNCQrVqZdPuFB7Ug0=3D > =3DpFHR > -----END PGP SIGNATURE----- >=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 |