PlayFramework2。在路由器中使用嵌套类

时间:2015-06-18 10:14:32

标签: java routes playframework-2.2

我想知道是否可以使用嵌套类作为路由目的地。

这是我的方法:

package controllers;
public class MainController {
    public static class NestedController {
        public Result submit() {
            return ok();
        }
    }
}

路由文件:

GET  /main/nested controllers.MainController$NestedController.submit()

但是我收到了一个错误:

[error] /home/user/git/play/conf/routes:23: object MainController$NestedController is not a member of package controllers
[error] GET /main/nested controllers.MainController$NestedController.submit()

当我以这种方式设置路由文件时:

GET  /main/nested controllers.MainController.NestedController.submit()

我收到错误:

[error] /home/user/git/play/conf/routes:23: MainController is already defined as object MainController

请帮忙

0 个答案:

没有答案