How can I load or resolve the template from a specified location

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How can I load or resolve the template from a specified location

JackStrong
hi guys,
It is the first time that I use thymeleaf.
I'm wondering is there anyway that I can resolve template from a specified location?

eg.:
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
        resolver.setPrefix("templates/");
        resolver.setSuffix(".html");
        resolver.setCharacterEncoding("UTF-8");
        resolver.setCacheable(false);
        resolver.setTemplateMode("HTML5");

 TemplateEngine templateEngine = new TemplateEngine();
        templateEngine.setTemplateResolver(resolver);

 WebContext context = new WebContext(request, response, request.getServletContext());

context.setVariable("parms", xxxxx);
templateEngine.process(templateName, context, write);


question:
can i resove template from "/data/test/template"?  Or is there anyway I load the template?

help please,
thanks