“值上下文不是播放应用程序中对象play.mvc.Http的成员”

时间:2014-05-11 16:05:18

标签: configuration compilation playframework-2.1

当我尝试编译我的播放应用程序时,我收到以下错误。请任何人帮我修复此错误..

    [info] Compiling 4 Scala sources and 3 Java sources to     /home/decathlon/play/samples/java/myApp/target/scala-2.10/classes...
   [error] /home/decathlon/play/samples/java/myApp/app/views/index.scala.html:0: value Context is not a member of object play.mvc.Http
   [error] /home/decathlon/play/samples/java/myApp/app/views/main.scala.html:0: value Context is not a member of object play.mvc.Http
   [error] two errors found
   [error] (compile:compile) Compilation failed
   [error] Total time: 1 s, completed 11 May, 2014 9:24:02 PM

1 个答案:

答案 0 :(得分:1)

按照主模板

中的模板参数@(content: Html)进行操作

索引模板中你应该有类似这样的东西

@main() {
    <div>..</div>
}

在控制器中就像这样

public static Result index() {
    return ok(
        index.render()
    );
}