控制器中的路由和子包 [英] Routes and subpackages in controllers

查看:135
本文介绍了控制器中的路由和子包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using Play 2.1 and I'm having some odd problems.

我在控制器包中有一个子包消息 i18n.java

I have a subpackage messages in the controllers package with a class i18n.java.

我的路线文件如下所示:

GET     \    controllers.messages.i18n.index()
POST    \    controllers.messages.i18n.process()

我现在有一个表格,其行动如下:

I now have a form with the following action:

@helper.form(action = routes.messages.i18n.process())

但是这给了我错误:

值消息不是对象controllers.routes的成员

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

I've used subpackages before in Play 2.0.4 and it worked fine like that, can anyone spot any errors in my configuration?

routes文件不会抱怨它找不到控制器。

The routes file doesn't complain that it can't find the controller.

推荐答案

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

The route should be controllers.messages.routes.i18n.process(). You can inspect the target/scala-2.10/src_managed directory to discover generated files.

有关信息,请参阅Java编码约定说一个类必须以大写开头。

And for information, Java coding conventions say that a class must start with an uppercase.

这篇关于控制器中的路由和子包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆