为什么这条简单的路线不起作用?

mai*_*har 1 routes playframework-2.0

Play教程显示了将动态参数绑定到URL的方法:

GET /clients/:id controllers.Clients.show(id: Long)

我想在我的应用程序中做同样的事情.但是当我写GET /Category/getAttributes/:id controllers.Category.getAttributes(id)下去的时候,http://localhost:9000/Category/getAttributes?id=4fce5fc51712ccf77afa7439我收到Action not found了下面列出的路线的错误.有适当的路线.

问题是:我错过了什么?我的PLay应用程序中的路由适用于其他请求,这是唯一一个带有动态参数的请求.

bie*_*ior 5

使用String类型,我怀疑是否4fce5fc51712ccf77afa7439可以被视为Long:

GET /clients/:id    controllers.Clients.show(id: String)
Run Code Online (Sandbox Code Playgroud)

当然不要忘记修改id控制器和模型的类型

编辑:Ech,我错过了第二个重要的更改,此路线的网址应该没有?id=:

http://localhost:9000/Category/getAttributes/4fce5fc51712ccf77afa7439
Run Code Online (Sandbox Code Playgroud)