Forms 验证(“…”,{case(a,b)=>;})可以';不可编辑
从play2的文档:,有一个示例代码:Forms 验证(“…”,{case(a,b)=>;})可以';不可编辑,forms,validation,playframework-2.0,Forms,Validation,Playframework 2.0,从play2的文档:,有一个示例代码: val loginForm = Form( tuple( "email" -> nonEmptyText, "password" -> text ) verifying("Invalid user name or password", { case (e, p) => User.authenticate(e,p).isDefined }) ) 但无法编译,错误消息为: Multiple mar
val loginForm = Form(
tuple(
"email" -> nonEmptyText,
"password" -> text
) verifying("Invalid user name or password", {
case (e, p) => User.authenticate(e,p).isDefined
})
)
但无法编译,错误消息为:
Multiple markers at this line
- missing parameter type for expanded function The argument types of an anonymous
function must be fully known. (SLS 8.5) Expected type was: ?
应写为:
verifying("Invalid user name or password", params => params match {
case (e, p) => User.authenticate(e,p).isDefined
}
我的播放版本是最新的play2.1-SNAPSHOT(2012-03-18)
文档有什么问题吗,或者我遗漏了什么吗?文档已经过时/错误,您的第二个版本是正确的。你可以自己修改文档,这是一个维基。谢谢,但我似乎没有修改它的权限。