执行模版引擎
我们的上下文对象已经准备好了,现在我们可以让模版引擎处理模版了(通过名字)。使用上下文,同时传给它一个response writer,这样就能把response写入到它里面:
templateEngine.process("home", ctx, response.getWriter());
让我们看看使用西班牙🇪🇸地区后的结果:
<!DOCTYPE html>
<html>
<head>
<title>Good Thymes Virtual Grocery</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<link rel="stylesheet" type="text/css" media="all" href="/gtvg/css/gtvg.css" />
</head>
<body>
<p>¡Bienvenido a nuestra tienda de comestibles!</p>
</body>
</html>