Scala 如何在Play 2中从视图样板定义管线中的多个值

Scala 如何在Play 2中从视图样板定义管线中的多个值,scala,routes,playframework-2.0,Scala,Routes,Playframework 2.0,在我的Play 2.4.4项目中,我有一个视图模板,我希望返回两个值,一个长值和一个字符串 我有一个按钮,用于调用控制器中的相应方法: <p> <a href="@controllers.routes.Orders.rollbackStatus(order.id, order.status.toString)" class="btn">@Messages("orders.rollback")</a> </p> 在我的routes文

在我的Play 2.4.4项目中,我有一个视图模板,我希望返回两个值,一个长值和一个字符串

我有一个按钮,用于调用控制器中的相应方法:

<p>
  <a href="@controllers.routes.Orders.rollbackStatus(order.id, order.status.toString)" 
     class="btn">@Messages("orders.rollback")</a>
</p>
在我的routes文件中,我定义了HTTP方法、URI和控制器方法:

GET  /orders/:id/:status  controllers.Orders.rollbackStatus(id: Long, status: String)
然而,当我按下按钮时,我收到以下消息:

错误的请求 对于请求“GET/orders/3,PLACED”[无法解析参数id,因为:对于输入字符串:“3,PLACED”]

我成功地以同样的方式传递了单个值

以下是为/订单定义的其余路线:

GET /orders             controllers.Orders.list
GET /orders/pickorder   controllers.Orders.getOrder
GET /orders/:id         controllers.Orders.show(id: Long)
GET /orders/:id/:status controllers.Orders.rollbackStatus(id: Long, status: String)

我找到了答案,当您指定第一个参数时,您使用“/:”来定义参数的名称

所有后续参数仅用“/”分隔

我相信这是因为“:”指定了参数的开始,但是这在播放文档中并不清楚

以下是正确的路线列表,所有其他代码与问题中提供的代码相同:

GET /orders             controllers.Orders.list
GET /orders/pickorder   controllers.Orders.getOrder
GET /orders/:id         controllers.Orders.show(id: Long)
GET /orders/:id/status controllers.Orders.rollbackStatus(id: Long, status: String)

按显示顺序显示您的所有
GET/orders/…
路线似乎
GET/orders/3,放置的
缺少一个
/
我已为GET/orders/添加了所有路线。
GET /orders             controllers.Orders.list
GET /orders/pickorder   controllers.Orders.getOrder
GET /orders/:id         controllers.Orders.show(id: Long)
GET /orders/:id/status controllers.Orders.rollbackStatus(id: Long, status: String)