欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Grails
来自开放百科 - 灰狐
(版本间的差异)
第6行: | 第6行: | ||
Grails构建在开源技术如[[Spring]]、[[Hibernate]]和[[SiteMesh]]之上,提供了一个类似于[[Rails]] 的平台可以与Java平台无缝集成. [[Groovy]]是一种“动态”或指令语言。动态语言一般用来加速和简化程序撰写。与Python或Ruby等其他指令语言不同的是,用Groovy撰写的程序,可与Java虚拟器结合。 | Grails构建在开源技术如[[Spring]]、[[Hibernate]]和[[SiteMesh]]之上,提供了一个类似于[[Rails]] 的平台可以与Java平台无缝集成. [[Groovy]]是一种“动态”或指令语言。动态语言一般用来加速和简化程序撰写。与Python或Ruby等其他指令语言不同的是,用Groovy撰写的程序,可与Java虚拟器结合。 | ||
+ | ==Install== | ||
+ | wget http://dist.codehaus.org/grails/grails-bin-1.0-RC3.zip | ||
+ | GRAILS_HOME= C:\grails-1.0-RC3 or /usr/local/grails-1.0-RC3 | ||
+ | Add the "%GRAILS_HOME%\bin" directory to your PATH environment variable | ||
+ | Add the "%GRAILS_HOME%\ant\bin directory to your PATH environment variable. | ||
+ | |||
+ | grails create-app | ||
+ | input project name: my-project | ||
+ | cd my-project | ||
+ | grails create-domain-class | ||
+ | input domain name: Book | ||
+ | my-project\grails-app\domain\Book.groovy | ||
+ | class Book { | ||
+ | String title | ||
+ | String author | ||
+ | } | ||
+ | my-project\grails-app\conf\BootStrap.groovy | ||
+ | class BootStrap { | ||
+ | |||
+ | def init = { servletContext -> | ||
+ | // Create some test data | ||
+ | new Book(author:"Stephen King",title:"The Shining").save() | ||
+ | new Book(author:"James Patterson",title:"Along Came a Spider").save() | ||
+ | } | ||
+ | def destroy = { | ||
+ | } | ||
+ | } | ||
+ | my-project\grails-app\controllers\BookController.groovy | ||
+ | grails run-app | ||
+ | http://localhost:8080/my-project/ | ||
+ | http://localhost:8080/my-project/book | ||
+ | 运行成功 :) | ||
+ | To upgrade your existing Grails projects you must run: | ||
+ | grails clean | ||
+ | grails upgrade | ||
+ | |||
==相关链接== | ==相关链接== | ||
*http://grails.codehaus.org/ | *http://grails.codehaus.org/ | ||
[[Category:Web application frameworks]] | [[Category:Web application frameworks]] |
2008年1月15日 (二) 21:02的版本
Grails关注将"规约编程"(coding by convention)引入Groovy。它是一个开放源网络应用构架, 对Groovy语言起到杠杆作用,并且对Java网络开发起到补足作用。你可以用Grails 作为独立开发环境, 它隐藏了所有的配置细节,也可以将它同和入你的Java商务逻辑。
Grails关注与使开发最简化,而且Grails的解决方案来自于广泛的开发者,不只局限于Java社区。
Grails构建在开源技术如Spring、Hibernate和SiteMesh之上,提供了一个类似于Rails 的平台可以与Java平台无缝集成. Groovy是一种“动态”或指令语言。动态语言一般用来加速和简化程序撰写。与Python或Ruby等其他指令语言不同的是,用Groovy撰写的程序,可与Java虚拟器结合。
Install
wget http://dist.codehaus.org/grails/grails-bin-1.0-RC3.zip GRAILS_HOME= C:\grails-1.0-RC3 or /usr/local/grails-1.0-RC3 Add the "%GRAILS_HOME%\bin" directory to your PATH environment variable Add the "%GRAILS_HOME%\ant\bin directory to your PATH environment variable. grails create-app input project name: my-project cd my-project grails create-domain-class input domain name: Book
my-project\grails-app\domain\Book.groovy
class Book { String title String author }
my-project\grails-app\conf\BootStrap.groovy
class BootStrap {
def init = { servletContext -> // Create some test data new Book(author:"Stephen King",title:"The Shining").save() new Book(author:"James Patterson",title:"Along Came a Spider").save() } def destroy = { } }
my-project\grails-app\controllers\BookController.groovy
grails run-app http://localhost:8080/my-project/ http://localhost:8080/my-project/book 运行成功 :)
To upgrade your existing Grails projects you must run:
grails clean grails upgrade
相关链接
分享您的观点