I want to add html code inside a context variable to generate a html file composed by some html samples. Here is the code :
TemplateEngine templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
Context context = new Context();
context.setVariable("reportContent", getHtml(documents));
context.setVariable("reportTitle", "First report");
System.out.println(context.getVariable("reportContent"));
// Get the plain HTML with the resolved ${name} variable!
String html = templateEngine.process("ReportTemplate", context);
The getHtml(documents)
function returns basic html code but when it process, it converts the html code so html isn't read as html but as string.
I think this isn't so clear so here is an example :
<h2>Any phrase or word</h2>
becomes :
<h2>Any phrase or word</h2>
I'd like the html to stay exactly the same when using templateEngine.process()
I hope it is clear, if you have any question please ask.
Any idea?