Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试为 scala 模板参数定义默认值,例如:
@(user: Form[User] = Form[User])
我看到编译错误:
object play.data.Form is not a value
怎么了?
不幸的是,它不是这样工作的,您必须定义表单的演示文稿。您的用户类中可能有:
val requestForm = Form( mapping("field1" -> nonEmptyText, "field2" -> nonEmptyText)(User.apply)(User.unapply))
然后你可以像这样使用你的模板:
@(user: Form[User] = User.requestForm)
希望这可以帮助