thymeleaf TemplateEngine进程静态html代码(无文件模板)

时间:2018-04-17 09:16:46

标签: java thymeleaf

如何处理静态HTML代码?

通常我在文件中有html代码。

    @Autowired
    private TemplateEngine templateEngine;

    @Override
    public void sendMail(){
        ...     

        String body = this.templateEngine.process(templateName, context);
        // String body = this.templateEngine.process("<html>...</html>",context);

        final MimeMessage mimeMessage = this.mailSender.createMimeMessage();
        final MimeMessageHelper compose = new MimeMessageHelper(mimeMessage, StandardCharsets.UTF_8.toString());
       ...
       this.mailSender.send(mimeMessage);
}

0 个答案:

没有答案