# 14.3 configEngine

JFinal 3.0 introduced a new template engine module. Classes that inherit from JFinalConfig need to add a public void configEngine(Engine me) method for configuring the template engine. Here's an example code snippet:

public void configEngine(Engine me) {
  me.setDevMode(true);
  
  me.addSharedFunction("/view/common/layout.html");
  me.addSharedFunction("/view/common/paginate.html");
}
1
2
3
4
5
6

If your project upgrade doesn't require using the Template Engine, you can leave this method empty.

By default, JFinal 3.0 sets the ViewType to ViewType.JFINAL_TEMPLATE. If an older project is using the Freemarker template and you do not wish to change the template type, you need to specify me.setViewType(ViewType.FREE_MARKER) within the configConstant method. If you've already specified the ViewType in the past, you can ignore this step.

Last Updated: 9/22/2023, 7:59:19 AM