重载方法值[apply]无法应用于(play.api.data.Mapping [String])

时间:2014-05-26 10:48:49

标签: scala playframework playframework-2.0

我正在学习使用play和scala来构建一个Web应用程序,并且在复选框帖子方面遇到了一些问题。

我的控制器:

  val serviceForm = Form(tuple(
    "id" -> number,
    "name" -> text,
    "checkboxList" -> list(text)
  )
 )

我的HTML

<form action="/testCheckbox" method="POST">
 <input type="text" name="id">
 <input type="text" name="name">
 <input type="checkbox" name="checboxList[]"> cb1
 <input type="checkbox" name="checboxList[]"> cb2
 <input type="checkbox" name="checboxList[]"> cb3
..
</form>

POST DATA(来自chrome调试工具):

id: 1
name: test
checkboxList[]: 1
checkboxList[]: 2
checkboxList[]: 2

然后播放说[网页]:

Overloaded method value [apply] cannot be applied to (play.api.data.Mapping[String])

控制台:

overloaded method value apply with alternatives:
[error]   (rh:     play.api.mvc.RequestHeader)play.api.libs.iteratee.Iteratee[Array[Byte],play.api.mvc.SimpleResult] <and>
[error]   (request: play.api.mvc.Request[play.api.mvc.AnyContent])scala.concurrent.Future[play.api.mvc.SimpleResult]
[error]  cannot be applied to (play.api.data.Mapping[String])
[error]       "checkboxList" -> list(text)
[error]                       ^
[error] one error found
[error] (compile:compile) Compilation failed

有什么问题?

0 个答案:

没有答案