baseViewPath 设置由原来的configConstant(…) 方法中转移到了Routes 对象中,并且可以对不同的Routes对象分别设置,如下是示例:

    1. public class FrontRoutes extends Routes {
    2. public void config() {
    3. setBaseViewPath("/_view");
    4. add("/", IndexController.class, "/index");
    5. add("/project", ProjectController.class);
    6. }
    7. }

    从configConstant(…)转移到configRoute(…)中的好处是可以分别对不同的Routes进行设置,不同模块的baseViewPath很可能不相同,从而可以减少冗余代码。上面的代码示例是用于Routes拆分后的情况,如果你的应用并没有对Routes进行拆分,只需要在configRoute 中如下配置即可:

    1. public void configRoute(Routes me) {
    2. me.setBaseViewPath("/_view");
    3. me.add("/", IndexController.class);
    4. }