我是Java的新手,我正在使用play framework 2.0进行项目,并且想知道如何使用反向路由功能.我们有以下内容:
在路线文件中
GET / controllers.Application.index()
GET /myapp/storage controllers.myapp.AnotherController.index()
Run Code Online (Sandbox Code Playgroud)
所以要使用反向路由:
controllers.routes.ref.Application.index()
Run Code Online (Sandbox Code Playgroud)
但是怎么样AnotherController?
如果我controllers.routes.ref.AnotherController.index()在测试中使用,播放框架将抛出错误"找不到符号".
谢谢.
avi*_*vik 12
尝试删除ref元素.我在play-2.0.4 app中使用以下结构进行反向路由:
<full-package-name>.routes.<controller>.<action>
Run Code Online (Sandbox Code Playgroud)
因此,第二次行动的反向路线将是:
controllers.myapp.routes.AnotherController.index()
Run Code Online (Sandbox Code Playgroud)
鉴于你的动作没有参数,我想你也可以删除括号:
controllers.myapp.routes.AnotherController.index
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5644 次 |
| 最近记录: |