study-note

3. View(Twirlテンプレート)

目次

Twirlテンプレートとは

テンプレートファイルの場所と名前

基本構文

例:

hello.scala.html ```scala @(name: String)

Hello @name!

```
呼び出し元(Controller側) ```scala def hello(name: String) = Action { Ok(views.html.hello(name)) } ```

テンプレート分割(共通レイアウト)

共通のレイアウトを分離して、ヘッダーやフッターを一元管理できる

@main("タイトル") {
  <h1>中身</h1>
}


4. Routing