Grails : Hello world
by toy
So, I guess this is the beginning of every language, The hello world. No books can be finished without having “HelloWorld”.
So, after the installation of Grails, according to this topic http://www.noppanit.com/?p=111 we’re going to build Hello world project.
1. Setup grails path.
2. run the script, grails create-app hello.
3. You will see the directory hello you have just created.
4. create a controller, name hello by typing grails create-controller hello under the hello directory.
5. So now, you have one web application and one controller.
6. open HelloController.groovy in …\grails-app\controllers\HelloController.groovy, you can use your favourite IDE, but I’m using Eclipse.
7. Insert this line
1 2 3 |
8. You can see that I’m using java.util.Date(), yeah right!!, because grails has been tighted with Java.
9. Test your application by typing, grails run-app, grails will use Jetty as a Application Server.
10. You can change your controller without rebooting the Application Server. Isn’t that good? Haha.
11. Bam!!! your first web application without any configurations.
Twitter
Facebook