Re: Template constructor's parameters

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
It's used to resolve relative names in [#include] directives within  
the template, as well as for identifying the template in error  
reporting. Also, it is returned by the built-in variable named  
".template_name". That's all. You can set it to whatever you want,  
although a row id from the db, or even the SQL query text to select it  
from the db would be friendlier than null.

Attila.

--
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com

On 2009.04.20., at 22:16, TioDuke wrote:

> Hi,
>
> When calling freemarker.template.Template class's constructor, which  
> is the purpose of the 'name' parameter?
>
> In our application we are storing our templates' raw text in a  
> database. Is it sane to pass null to the constructor instead? Is the  
> template supposed to be stored with this 'name' under the  
> 'directoryForTemplateLoading' defined in Configuration? Do I  
> actually need to define a 'directoryForTemplateLoading' when  
> instancing Configuration or is it safe no to do at all or even to  
> use the default configuration? Remember, our templates reside in the  
> database and we call the Template constructor explicitly... and then  
> the only thing we do with the template is to process in order to  
> 'cook' some text.
>
> Thanks in advance.
>
> -- 
> --
> Best regards,
>
> Sergio Tridente


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.