4

This is my Application.Scala

package controllers

import play.api._
import play.api.data.Form
import play.api.mvc._



import _root_.scala.xml.Text


object Application extends Controller {

  def index = Action {
    Redirect(routes.Application.tasks)
  }


  def deleteTask(id: Long) = TODO

  val taskForm = Form(
  "label" -> nonEmptyText
)
def tasks = Action {
  Ok(views.html.index(Task.all(), taskForm))
}

  def newTask = Action { implicit request =>
  taskForm.bindFromRequest.fold(
    errors => BadRequest(views.html.index(Task.all(), errors)),
    label => {
      Task.create(label)
      Redirect(routes.Application.tasks)
    }
  )
}
}

I'm using play 2.0 framework. Where am I going wrong to get such an error?

4

2 回答 2

5

You can browse Play 2 docs here. By looking at the index I found that nonEmptyText is contained in play.api.data.Forms object.

So, you need to either add import play.api.data.Forms._ as already suggested or replace the current not found symbol with Forms.nonEmptyText since it's already imported.

于 2012-07-22T23:38:18.273 回答
0

I found that restarting the server solved the issue for me.

于 2014-05-24T09:53:40.563 回答