控制器中的路由和子包

Aer*_*rus 14 java routes playframework-2.1

我正在使用Play 2.1,我遇到了一些奇怪的问题.

messagescontrollers包中有一个类的子包i18n.java.

我的routes文件看起来像这样:

GET     \    controllers.messages.i18n.index()
POST    \    controllers.messages.i18n.process()
Run Code Online (Sandbox Code Playgroud)

我现在有一个表单,其中包含以下操作:

@helper.form(action = routes.messages.i18n.process())
Run Code Online (Sandbox Code Playgroud)

但这给了我一个错误:

value messages is not a member of object controllers.routes

我之前在Play 2.0.4中使用过子包,它工作得很好,有人能发现我配置中的任何错误吗?

路由文件不会抱怨它找不到控制器.

Jul*_*ont 19

路线应该是controllers.messages.routes.i18n.process().您可以检查target/scala-2.10/src_managed目录以发现生成的文件.

有关信息,Java编码约定表明类必须以大写开头.


dux*_*x0r 11

仅供参考,在2.2中它略有不同.

routes.conf看起来像:

GET  /admin/stuff  controllers.admin.StuffController.show()
Run Code Online (Sandbox Code Playgroud)

在代码中看起来像:

controllers.admin.routes.StuffController.show()
Run Code Online (Sandbox Code Playgroud)