Re: Template Caching doesn't work
Daniel Dekany <[email protected]> Tue, 23 Apr 2013 22:22:05 +0200
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
But the problem is that you are supposed to set the TempateLoader only
*once* in the life-cycle of the app, earlier than you start processing
any templates. Normally, you do that when the application is
initialized. You set up the Configuration object there, and then you
don't change anything in it anymore.
--
Thanks,
Daniel Dekany
Monday, April 22, 2013, 3:34:39 PM, chintan4181 wrote:
> If i don't set configuration.setTemplateLoader(ftl); then it gives me an
> exception saying "Template not found".
>
> I am loading template from physical location.
>
> String templateDir =
> "C:\\workspace\\static-artifacts\\email-templates";
> String templateFileName = "mail-template.ftl";
>
> This is how i am using above to variables
>
> private String getContent(String templateFileName, String templatedir,
> java.util.Map<String, Object> dynamicParams) throws Exception {
>
> if(ftl == null)
> ftl = new FileTemplateLoader(new File(templatedir));
> //if i comment below line, then i am getting "template not found"
> exception
> configuration.setTemplateLoader(ftl);
>
> template =
> configuration.getTemplate(templateFileName);
>
> String result =
> FreeMarkerTemplateUtils.processTemplateIntoString(template, dynamicParams);
>
> return result;
>
>
>
>
>
> --
> View this message in context:
> http://freemarker.624813.n4.nabble.com/Template-Caching-doesn-t-work-tp4654527p4654529.html
> Sent from the freemarker-user mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr