実行環境

結構メモリを使うのでLinuxの1GB程度のマシンだと厳しい。

インストール

ディレクトリ構成

root
  grails-app

構成要素

  1. Controller
  2. Service(Logic層)
  3. Domain Class(ORマッピング)
  4. View(GSP)

各モジュール等の作成

アプリケーションの作成

コントローラーの作成

ドメインクラスの作成

ドメインクラスを作成すると、テスト環境ではH2データベースにテーブルが作成される!

Scaffold

  1. ドメインクラスを作成
  2. Scafffoldを作成
grails> create-domain-class  book
| Created grails-app/domain/sample/Book.groovy
| Created src/test/groovy/sample/BookSpec.groov
grails> generate-all sample.Book
| Rendered template Spec.groovy to destination src\test\groovy\sample\BookControllerSpec.groovy
| Rendered template edit.gsp to destination grails-app\views\book\edit.gsp
| Rendered template create.gsp to destination grails-app\views\book\create.gsp
| Rendered template index.gsp to destination grails-app\views\book\index.gsp
| Rendered template show.gsp to destination grails-app\views\book\show.gsp
| Scaffolding completed for grails-app\domain\sample\Book.groovy
Counter: 2532, today: 1, yesterday: 1

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS