执行模版引擎

我们的上下文对象已经准备好了,现在我们可以让模版引擎处理模版了(通过名字)。使用上下文,同时传给它一个response writer,这样就能把response写入到它里面:

  1. templateEngine.process("home", ctx, response.getWriter());

让我们看看使用西班牙🇪🇸地区后的结果:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Good Thymes Virtual Grocery</title>
  5. <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
  6. <link rel="stylesheet" type="text/css" media="all" href="/gtvg/css/gtvg.css" />
  7. </head>
  8. <body>
  9. <p>¡Bienvenido a nuestra tienda de comestibles!</p>
  10. </body>
  11. </html>