I'm trying to call a main layout from a view (just like in docs ) but I get the error:
[error] C:\Users\Marco\Documents\Devel\Java\DroversWeb\app\views\device\list.sca
la.html:1: too many arguments for method apply: ()play.twirl.api.HtmlFormat.Appe
ndable in object _layout
[error] @views.html.shared._layout("User")
[error] ^
[error] C:\Users\Marco\Documents\Devel\Java\DroversWeb\app\views\shared\_layout.
scala.html:1: not found: value title
[error] ?@(title: String)
[error] ^
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 34 s, completed 29-gen-2015 16.27.59
Here is the code I'm trying to use: CONTROLLER
public static Result list() {
return ok(views.html.device.list.render());
}
LIST VIEW
@views.html.shared._layout("User")
** _LAYOUT **
@(title: String)
<!DOCTYPE html>
<html lang="en">
<head>
....
</html>
** BUILD.SBT
...
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.5"
libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.3.0-2",
"org.webjars" % "bootstrap" % "3.3.1",
"org.webjars" % "jquery" % "2.1.1",
"org.webjars" % "pace" % "1.0.2",
"org.webjars" % "font-awesome" % "4.2.0",
"org.webjars" % "jquery-ui" % "1.11.2",
javaJdbc,
javaEbean,
cache,
javaWs,
"org.mongodb" % "mongo-java-driver" % "2.12.5",
"org.mongodb.morphia" % "morphia" % "0.109",
"org.mongodb.morphia" % "morphia-logging-slf4j" % "0.109",
"org.mongodb.morphia" % "morphia-validation" % "0.109",
"be.objectify" %% "deadbolt-java" % "2.3.2",
"com.feth" %% "play-authenticate" % "0.6.8"
)
** PLUGINS.SBT **
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.7")
// web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")
What's wrong with the code?
I tried also with (content: Html)
in _layout and the html code in list.scala.html but the compiler stops always after @(
with not found: value title
If I remove the parameters in the layout and call it with @views.html.shared._layout()
it compiles correctly.