octavian octavian - 2 months ago 13
Scala Question

Play too many arguments for method Apply

I am doing a Play2 and Scala tutorial from Pluralsight.

I created a default project and I configured it this way:

controller

Application.scala


package controllers

import play.api._
import play.api.mvc._

class Application extends Controller {

def index = Action {
Ok(views.html.index("Hello, again, world!"))
}

}


view
index.scala.html


(@message: String)
<!doctype html>

<html>
<head>
<title>
Play 2 for Scala!
</title>
</head>

<body>
<h1>
@message
</h1>
</body>
</html>


I have the following route in my route file:

GET / controllers.Application.index


My issue is that when I try to access
http://localhost:9000/
, I get:

too many arguments for method apply: ()play.twirl.api.HtmlFormat.Appendable in class index

6class Application extends Controller {
7
8 def index = Action {
9 Ok(views.html.index("Hello, again, world!"))
10 }
11
12}

Answer

Parameter list that you declared in your view is wrong

(@message: String)

It should be

@(message: String)