【问题标题】:How to set CRUD in a subpackage with Play如何使用 Play 在子包中设置 CRUD
【发布时间】:2012-01-04 08:09:41
【问题描述】:

我正在尝试在子包中使用 CRUD 模块而不是默认模块。

package controllers.admin;

import models.Branch;
import controllers.CRUD;

    @CRUD.For(Branch.class)
    public class Branches extends CRUD {

        public static void index() {
            render();
        }

    }

我的路线文件是:

# Import CRUD routes
*       /admin                                       module:crud

但是,当我使用默认网址时:http://localhost:9000/admin/ 我收到模板未找到错误:

Template not found
The template admin/Branches/index.html does not exist.

如何指定 CRUD 模块在子包中查找视图?

【问题讨论】:

    标签: module playframework crud


    【解决方案1】:

    好的。控制器是使用 eclipse 插件生成的,并包含 index() 方法。 删除它解决了问题,模块现在可以正常工作了。

    【讨论】:

    • 注意:要让 play crud:override 工作,我必须修改 python 脚本 crud\commands.py 以将视图放在管理文件夹中:'app/views/%s/%s .html' --> 'app/views/admin/%s/%s.html'
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-03
    • 2015-11-25
    • 1970-01-01
    • 1970-01-01
    • 2014-07-24
    • 1970-01-01
    相关资源
    最近更新 更多