2015-01-29 12 views
0

내가 (단지 docs처럼) 뷰에서 메인 레이아웃을 호출하기 위해 노력하고있어 또 다른 관점에서보기를 호출하지만 오류 얻을 : 여기플레이 프레임 워크 - 매개 변수

[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] [email protected](title: String) 
[error] ^
[error] two errors found 
[error] (compile:compile) Compilation failed 
[error] Total time: 34 s, completed 29-gen-2015 16.27.59 

내가 '코드입니다 m 사용하려고 : CONTROLLER

public static Result list() { 
     return ok(views.html.device.list.render()); 
    } 

목록보기

@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") 

?

나는 _layout에서 (content: Html) 및 list.scala.html의 HTML 코드도 시도했지만 내가 레이아웃의 매개 변수를 제거하고 올바르게 컴파일 @views.html.shared._layout()로 호출하면 컴파일러는 not found: value title

@( 후 항상 중지 .

+0

제공 코드가 완벽하게 잘 작동합니다. 앱을 청소하고 다시 시작해 보셨습니까? –

+0

예, 청소하고 다시 시작했지만 운이 없습니다. 나는 build.sbt와 plugins.sbt로 게시물을 갱신했다. – Marco

+0

'@ views.html.shared._layout (title = "User")' –

답변

0

(Solved by a question edit - converted to a community wiki answer.)

영업 썼다 :

Starting from scratch I have now a project able to compile... everything is identical, I copied one by one the files in order to find out the issue but no problem so far. With winmerge I took a look at the folders and I can see that, in target\scala-2.11\twirl....\shared_layout.template.html the working one is:

/**/ 
object _layout extends BaseScalaTemplate[play.twirl.api.HtmlFormat.Appendable,Format[play.twirl.api.HtmlFormat.Appendable]](play.twirl.api.HtmlFormat) with play.twirl.api.Template1[String,play.twirl.api.HtmlFormat.Appendable] { 

    /**/ 
    def apply/*1.2*/(title: String):play.twirl.api.HtmlFormat.Appendable = { 
     _display_ { 

and the not working one is:

/**/ 
object _layout extends BaseScalaTemplate[play.twirl.api.HtmlFormat.Appendable,Format[play.twirl.api.HtmlFormat.Appendable]](play.twirl.api.HtmlFormat) with play.twirl.api.Template0[play.twirl.api.HtmlFormat.Appendable] { 

    /**/ 
    def apply():play.twirl.api.HtmlFormat.Appendable = { 
     _display_ { 

I removed the _layout file from the original project, copied the new one (identical from winmerge point of view) and now it works.