All,
My Web publishers wish to merge data with a variety of Velocity Templates and provide
the results to users as downloadable files (mostly TSV formatted).
Background:
I'm having them construct templates with tags which will be resolved using the Pull
service. My download processing already works fine - any content contained in a
StringBuffer can be downloaded to the user (preceded by the usual request to "save as
file").
Problem:
I need to invoke a Turbine/Velocity method, from within my Action method, which will
perform the merge & pull processing and yield output which I can capture and send via
my download processing.
"velocity.app.Velocity.templateMerge(template name,encoding,context,writer)" seems
like a near fit. Is this the way to go? (What should be used for the "encoding" parm
here?) Is there some other method, callable within this context, designed to perform
the merge as part of the Velocity _service_ which I should be using?
Some sample code (in my doProvide_tsv() method) :
StringWriter strw_Obj = new StringWriter;
Velocity.mergeTemplate("the,TVSDataForm.vm", strw_Obj); // deprecated form
RawContent rcSender = new RawContent();
rcSender.setStr_Filename("data.tsv");
rcSender.setStrw__Content(strw_Obj ); //gets buffer from writer
rcSender.doOutput( runData); // pushes content to user
( I run into a problem using the Velocity.mergeTemplate() method - it seems to use a
different FileLoader path than that used by Turbine when locating template files.)
TIA for all responses.
Jeff Gehrung (Sr. Programmer Analyst)
Holstein Association USA
Brattleboro VT 05302
802.451.4146
[EMAIL PROTECTED]
[EMAIL PROTECTED]
I'm told "42" answers most ?s.
---------------------------------
Do you Yahoo!?
HotJobs - Search new jobs daily now