Last updated by admin 3 years ago
??? ????
Grails ???? ???
Grails? ?????, ??? ??? ???? ? ????? ??? ? ????:grails 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 = ""
}??? ??? ????
(???? ??? "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
}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
http://localhost:8080/my-project/book/list
http://localhost:8080/my-project/book



