Re: usage of Dataloaders in non-fmpp Java programs
Daniel Dekany <[email protected]> Sun, 25 Jun 2006 23:17:11 +0200
| Newsgroups | gmane.comp.text.fmpp |
|---|---|
| Message-ID | <[email protected]> |
Sunday, June 25, 2006, 8:25:30 PM, Thomas Bayen wrote: > Hello, > > I wrote a nice template set to create a big static website from some > CSV-Files. But now I need to create some of the pages dynamically, so I will > have to use Tomcat, write a web container and call FMPP (or Freemarker?) > directly. > > As I see it is not easy to access the loaded data from within Java. I can't > just simply say "load the configuration data into this hash", deal with the > data in Java and say "use this hash with FMPP and create my output". > > The Dataloaders (especially the CsvDataLoader) returns a TemplateModel. Would > it not be nicer if it returns a simple Java-"Map"? FreeMarker would wrap it > and work as before. What would happen if we try to change CsvSequence to be a > Map? You can't do it in general. The TemplateModel-s (these are the FreeMarker variables basically) has abilities that java.util/java.lang suff hasn't. Like I can't create a value that is both a Map and a List with J2SE classes, but I can with TemplateModel-s. OK, most data loaders don't utilize these things, but for example the CSV data loader is one that does. > Your very nice configuration Syntax (tdd, reading of csv, ...) would not > depend on FreeMarker. I could think of many uses of this nice Dataloaders > apart from FreeMarker. Well, these are something to consider when (and if) I write preprocessor next time, so thanks for the thoughts. As of FMPP, it's practically impossible that I will refactor it to work this way, since I'm way too busy with other OSS things that I give higher priority. You see, I have to chose which thumb if mine I want to bite... Anyway, is there any obstacle in doing this what you wanted? I mean, if you write data loaders that return non-FreeMarker objects only, then it's what you wanted, isn't it? > Ciao, > > Thomas Bayen > Linux User Group Krefeld -- Best regards, Daniel Dekany Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642