...
| Bloque de código | ||
|---|---|---|
| ||
import org.thymeleaf.context.Context;
// Añadimos templateEngine a la clase utilizando autowired
@Autowired
private TemplateEngine templateEngine;
...
final Context ctx = new Context();
ctx.setVariable( "usuario", "willy" );
ctx.setVariable( "documento", "un pdf" );
ctx.setVariable( "direccion", "Calle Falsa 123" );
ctx.setVariable( "telefono", "666 666 666 7" );
ctx.setVariable( "email", "willy@willy.wi" );
ctx.setVariable( "centro", "Ática" );
ctx.setVariable( "iban", "ibienen" );
ctx.setVariable( "recibo", "231687496549" );
final String htmlContent = templateEngine.process( "email.html", ctx ); |
...