コントローラ内に記述したrenderの引数をindexビューの方で受け取りたいのですが、エラーを返されてしまいます。
そもそも記述方法として間違っているのでしょうか?
ご教授お願いします。
HomeController.java
Java
1package controllers; 2 3import play.mvc.*; 4import views.html.*; 5 6/** 7 * This controller contains an action to handle HTTP requests 8 * to the application's home page. 9 */ 10public class HomeController extends Controller { 11 12 /** 13 * An action that renders an HTML page with a welcome message. 14 * The configuration in the <code>routes</code> file means that 15 * this method will be called when the application receives a 16 * <code>GET</code> request with a path of <code>/</code>. 17 */ 18 public Result index() { 19 return ok(index.render( 20 "1段目", 21 "2段目" 22 )); 23 } 24 25
index.scala.html
@* * This template takes a single argument, a String containing a * message to display. *@ @(message: String) @* * Call the `main` template with two arguments. The first * argument is a `String` with the title of the page, the second * argument is an `Html` object containing the body of the page. *@ <!-- コントローラーから送られる値を受け取る --> @(one: String, two: String) <!-- htmlのbody部分 --> @main("Welcome to Play TEST01") { @* * Get an `Html` object by calling the built-in Play welcome * template and passing a `String` message. *@ <!-- デフォルトのwelcomページに飛ぶ --> @@play20.welcome(message, st![イメージ説明](c354376713b4afa83e246c6e345e200f.jpeg)"Java") <!-- --> <br> <h1>body変更テスト(index.scala.htmlの変更)<h1> <!-- 上記の受け取った値を記述 --> <li>@one <li>@two }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。