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: Form[Application.Login])
@main(title = "myTitle") {
<h2>Testing app</h2>
}
したがって、このファイルでは、親テンプレートを@main(...)で呼び出します。しかし、フォームを親テンプレートに渡す方法は? 私は次のことを試しました:
@(form: Form[Application.Login])
@main(title = "myTitle", form) {
<h2>Testing app</h2>
}
そして、私のmain.scala.htmlには次のように書かれています:
@(title: String, form: Form[Application.Login])(content: Html)
しかし、これは機能していません。次のエラー メッセージが表示されます。
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.