Grails Hello World

by mmahmoodict on 18 Apr 2014 11:03

Open terminal -

$ curl -s get.gvmtool.net | bash

Open new window and run -

$ gvm install grails
$ mkdir -p Dropbox/JavaProject/GrailsHelloWorld 
$ cd Dropbox/JavaProject/GrailsHelloWorld/
$ grails create-app helloworld
$ cd helloworld/
$ grails run-app

Visit - :-D

http://localhost:8080/helloworld/

Try running in different port -

$ grails run-app -Dgrails.server.port.http=8090

Grails console -

$ grails

Add simple controller -

$ grails create-controller hello

Open HelloController.groovy -

package helloworld

class HelloController {
    def index() {
        render "Hello World!"
    }
}
http://localhost:8080/helloworld/hello/index
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License