Learn about Grails

Source: Internet
Author: User
Tags grails

Grails website http://www.grails.org/is the way to introduce grails.
1 It can run on a Java virtual machine, combined with Java's first-Class 2 rapid development 3 using Java-like Dynamic Language 4 conventions better than configuration 5 reduce repetitive development 6 inspiration from Ruby
7 Powerful plug-in system
8 IDE Support

I am more inclined to the above advantages of 2nd and 4, really very convenient.

Here's a small case to look at Grails
1 First download grails via official website Http://www.grails.org/download.


2 Unzip it to any location on your local computer


3 You need to configure environment variables before using Grails, including the Java JDK's java_home (configuration process) and his ownGrails_home=/path/to/grails



4 test If the configuration is successful cmd input command grails-version carriage return, the version number is shown and the installation is successful.



5 Next we create a application to feel grails, and before you create it, you need to understand how grails is quickly creating what you want with commands.
through the Black Window CD command, go to any directory, or work space, run grails create-app HelloWorld command, you can create a HelloWorld project under the current directory.
Let's say I'm a project created under the test directory.





Here except In addition to the Grails Create-app command, all future commands need to be used under the project folder, so we'llCD HelloWorld

6 after the CD HelloWorld we can knockGrails, to start the grails interactive command line


At this point, press the TAB key to see the common commands under Grails, and so on.

7 Printing HelloWorld

We can pass grails> Create-controller Hello to create a new control class, at this point, you hit create-and then press the TAB key, with command completion function. So it doesn't matter if you can't remember.


After running the Create Control class command, Grails will be in your project folder Create a control class in controllers


Edit it


After that, in Cmd, pass thegrails> run-app command to start the project,



at this point, you can access it through the browserHttp://localhost:8080/helloworld/hello/index, you'll see the HelloWorld you wrote.
His path is accessed using the/action name of the project name/controller name

If you are prompted for port 8080, you can also change the port startup by using the following command




The above page is located under the View folderGRAILS-APP/VIEW/INDEX.GSP



 

Learn about Grails

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.