Playframework 2.0 将参数传递给父模板或子模板

Playframework 2.0 将参数传递给父模板或子模板,playframework-2.0,Playframework 2.0,在我的index方法中,我呈现了一个基本的登录表单,并将其发送到我的index.scala.html: /** * Main entry method for the application */ public static Result index() { return ok(views.html.index.render(form(Application.Login.class))); } 在文件index.scala.html中:我定义了表单参数: @(form: Form

在我的index方法中,我呈现了一个基本的登录表单,并将其发送到我的index.scala.html

/**
 * Main entry method for the application
 */
public static Result index() {
     return ok(views.html.index.render(form(Application.Login.class)));
}
在文件index.scala.html中:我定义了表单参数:

@(form: Form[Application.Login])

@main(title = "myTitle") {
    <h2>Testing app</h2>
}
但这不起作用,我收到以下错误消息:

not enough arguments for method apply: (title: java.lang.String, form: play.data.Form[controllers.Application.Login])(content: play.api.templates.Html)play.api.templates.Html in object main. Unspecified value parameter form.


正如朱利安所说,这是可行的:

@main(title = "myTitle", form = form) { … } or just @main("myTitle", form) { … } 

这可能是由于使用命名参数造成的问题。试试
@main(title=“myTitle”,form=form){…}
或者只是
@main(“myTitle”,form){…}
朱利安,是的,它正在工作。只是需要清理和运行我的应用程序。谢谢
not enough arguments for method apply: (title: java.lang.String, form: play.data.Form[controllers.Application.Login])(content: play.api.templates.Html)play.api.templates.Html in object main. Unspecified value parameter form.
@main(title = "myTitle", form = form) { … } or just @main("myTitle", form) { … }