I would like to add to the table "Person" when you press the button "Add a Person" but I get an error:
play.PlayExceptions$CompilationException: Compilation error[object inject is not a member of package javax]
at play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
at play.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library-2.11.1.jar:na]
...
controller is in the class Application:
package controllers
import play.api._
import play.api.mvc._
import play.api.data.Form
import play.api.data.Forms._
import play.api.libs.json.Json
import models._
import javax.inject._
class Application @Inject() (db: DB) extends Controller {
def index = Action {
Ok(views.html.index())
}
val personForm: Form[Person] = Form {
mapping(
"name" -> text
)(Person.apply)(Person.unapply)
}
def addPerson = Action { implicit request =>
val person = personForm.bindFromRequest.get
db.save(person)
Redirect(routes.Application.index)
}
}
I do not know how to add a library javax.inject-1.jar ?
Is there another solution . Thank for you help in this matter.