List 访问play framework中的列表[String]时出错
我试图访问控制器中的列表[String],因此我编写代码: 我的观点是List 访问play framework中的列表[String]时出错,list,scala,playframework-2.0,List,Scala,Playframework 2.0,我试图访问控制器中的列表[String],因此我编写代码: 我的观点是 @(path:List[String]) ... <button type=submit id=imgButton><a href="@routes.Application.confirmDelete(path)">Delete</a></button> 我的控制器是: def confirmDelete(path:List[String])=Action{
@(path:List[String])
...
<button type=submit id=imgButton><a href="@routes.Application.confirmDelete(path)">Delete</a></button>
我的控制器是:
def confirmDelete(path:List[String])=Action{
Ok("deleted "+path);
}
但它给了我一个错误
No URL path binder found for type List[String]. Try to implement an implicit PathBindable for this type.
这里的错误是绝对清楚的。Play不知道如何在uri之间序列化
List[String]
。您可以为List[String]
实现隐式PathBindable
转换,或者将此列表作为String
提交,并从String
参数在控制器端构建List[String]
关于可路径绑定的文档
您也可以在此处查看第二种解决方案-
No URL path binder found for type List[String]. Try to implement an implicit PathBindable for this type.