Grails - Korean Quick Start

??? ????

Grails ???? ???

Grails? ?????, ??? ??? ???? ? ????? ??? ? ????:

grails create-app
create-app ??? ????? ??? ??? ???, ??? ?? ???? ??? ??????:
%PROJECT_HOME%
    + grails-app
       + conf                 ---> ??? ?? ?? ?? ?? ???(artifact)?? ?? ??
       + controllers          ---> ???? ???? ?? ??
       + domain               ---> ??? ???? ?? ??
       + i18n                 ---> ???(i18n) ??? ??? ?? ??
       + services             ---> ??? ???? ?? ??
       + taglib               ---> ?? ?????? ?? ??
       + views                ---> ?(view)? ?? ??
           + layouts              ---> ????? ?? ??
   + lib
   + spring                    ---> ?? ??? Spring ??
   + hibernate                 ---> ?? ??? Hibernate ??
   + war
       + WEB-INF

??? ?? ???? (?? ??)

"create-app" ??? "<..>/grails-app/conf" ????? ? ?? ??? ?? ???? ??????. ? ??? ??? ??? ?? ??? ?????. ?? ??? ?? ??? ??? DevelopmentDataSource, ??? ??? ?? ??? ??? TestDataSource, ????? ???? ??? ?? ??? ??? ProductionDataSource ???. ?? ?? ??? ?? ??? ?? ??? ??? ???? ?? ???? ????. ??? ?? ? ??? ??? Korean Configuration ???? ?????.

????? ??? ?? HSQLDB? ????? ???? ????(???? ???? ????? ?? ????? ?? ???? ????). ??? ? ??? ?? ?????:

class DevelopmentDataSource {
   boolean pooling = true
   String dbCreate = "create-drop" // one of 'create', 'create-drop','update'
   String url = "jdbc:hsqldb:mem:testDB"
   String driverClassName = "org.hsqldb.jdbcDriver"
   String username = "sa"
   String password = ""
}
??? ??? ????? ??? ??? ??? ??? ??????? ????? ???? ?? ???? ?? ? ???? jar ??? <..>/lib ????? ???? ?? ?????.

??? ??? ????

(???? ??? "my-project"?? ????) "cd my-project" ??? ???? ????? ?? ????? ??? ? "grails create-domain-class" ???? ??? ???? ??? ???? ??? ?????. ??? ???? ???? ???(persistent artifact)?? ??? ???? ?? ??? ???? ??????? ?????. ? ??? ??? GORM (Grails Object Relational Mapping)? ?????:

class Book {
    Long id
    Long version

String title String author }

? ????, ?? ??? ???? ? ? ????? ?? ????. ??? ??? "<..>/grails-app/conf" ????? ?? Grails ?????? ????? ???? "init" ??? ???:
new Book(author:"Stephen King",title:"The Shining").save()
new Book(author:"James Patterson",title:"Along Came a Spider").save()

???? ????

????? Grails ??????? ?????, ? ??? ???? ?? URL? ???? ???? ???? ??? ??? ???? ???? ??? ???.

"grails create-controller" ??? ???? ??? ???? ????? ??? ?????. ?? ??? ???? ?? ????? "book"? ?????. ?? {{grails-app/controllers/BookController.groovy}} ??? ????? ????. ? ??? ??? ??? ?? ???? ?? ???? ? ?? ??????? ??? ??? ???? ???? ?????:

class BookController {
   def scaffold = Book
}

Grails ????

Grails ??????? ???? ???? ?? ??? ?????:

grails run-app
? ??? 8080 ??? ???? Jetty ??? ?? ????? ?????. 9090? ?? ?? ??? ???? ??? {{grails -Dserver.port-9090 run-app}} ? ?????. ? ?? ???? ????? ????? ???? ?? ??? ?????:
http://localhost:8080/my-project/book/list
??, "list" ???? BookController? ?? ???? ???? ???? ??? ?? ???? ???:
http://localhost:8080/my-project/book