Details
-
Temp
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.1.1
-
None
-
Tomcat 7.0
-
Important
Description
Loading the freemarker template from the file system using templatePath in web.xml is not working as expected
Example:
My template path is --> "file://D://templates"
try {
if(templatePath!=null){
if (templatePath.startsWith("class://"))
else if (templatePath.startsWith("file://"))
{ templatePathLoader = new FileTemplateLoader(new File(templatePath)); } }
} catch (IOException e)
Line "templatePathLoader = new FileTemplateLoader(new File(templatePath));" always return null
Fix:
By changing the above line as below, it's working fine.
templatePathLoader = new FileTemplateLoader(new File(templatePath.substring(7)));