tomcat7 のサーブレット 3.0 で Rythm テンプレート エンジンを使用しようとしています。テンプレートをディレクトリからエンジン
にレンダリングしたい。しかし、それはテンプレートを検出していません。WebContent
Rythm
サーブレットinit()
メソッドでは、Rthym エンジンを次のように初期化しました。
public void init(ServletConfig config) throws ServletException {
Map <String, Object> context = new HashMap <String, Object> ();
//String filePath = new File("").getAbsolutePath();
//filePath.concat("WebContent");
context.put("home.template", "WebContent");
Rythm.init(context);
}
次に、メソッドを使用NewFile.html
して次のようにレンダリングしようとしましたRythm.render
doGet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map <String, Object> args = new HashMap <String, Object> ();
args.put("a", "World");
PrintWriter out = response.getWriter();
out.println(Rythm.render("NewFile.html", args));
}
しかし、ブラウザには「NewFile.html」だけが表示されています(NewFile.htmlのコンテンツではなく、文字列「NewFile.html」のみ)