This is a simple Grails web application with a basic form to create and edit a person and addresses.
Note | |
---|---|
If Grails isn't installed, download it from the Grails Download page and follow the Installation Instructions. |
Create the Grails application, domain classes, and controller classes using Grails commands.
Create the application by running the grails create-app command.
$ grails create-app simple-grails-webapp
Welcome to Grails 1.1.2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails
Base Directory: ...
Running script /usr/local/grails/scripts/CreateApp_.groovy
Environment set to development
[mkdir] Created dir: /simple-grails-webapp/src
[mkdir] Created dir: /simple-grails-webapp/src/java
[mkdir] Created dir: /simple-grails-webapp/src/groovy
[mkdir] Created dir: /simple-grails-webapp/grails-app
[mkdir] Created dir: /simple-grails-webapp/grails-app/controllers
[mkdir] Created dir: /simple-grails-webapp/grails-app/services
[mkdir] Created dir: /simple-grails-webapp/grails-app/domain
[mkdir] Created dir: /simple-grails-webapp/grails-app/taglib
[mkdir] Created dir: /simple-grails-webapp/grails-app/utils
[mkdir] Created dir: /simple-grails-webapp/grails-app/views
[mkdir] Created dir: /simple-grails-webapp/grails-app/views/layouts
[mkdir] Created dir: /simple-grails-webapp/grails-app/i18n
[mkdir] Created dir: /simple-grails-webapp/grails-app/conf
[mkdir] Created dir: /simple-grails-webapp/test
[mkdir] Created dir: /simple-grails-webapp/test/unit
[mkdir] Created dir: /simple-grails-webapp/test/integration
[mkdir] Created dir: /simple-grails-webapp/scripts
[mkdir] Created dir: /simple-grails-webapp/web-app
[mkdir] Created dir: /simple-grails-webapp/web-app/js
[mkdir] Created dir: /simple-grails-webapp/web-app/css
[mkdir] Created dir: /simple-grails-webapp/web-app/images
[mkdir] Created dir: /simple-grails-webapp/web-app/META-INF
[mkdir] Created dir: /simple-grails-webapp/lib
[mkdir] Created dir: /simple-grails-webapp/grails-app/conf/spring
[mkdir] Created dir: /simple-grails-webapp/grails-app/conf/hibernate
[propertyfile] Creating new property file: /simple-grails-webapp/application.properties
[copy] Copying 1 resource to /simple-grails-webapp
[unjar] Expanding: /simple-grails-webapp/grails-shared-files.jar into /simple-grails-webapp
[delete] Deleting: /simple-grails-webapp/grails-shared-files.jar
[copy] Copying 1 resource to /simple-grails-webapp
[unjar] Expanding: /simple-grails-webapp/grails-app-files.jar into /simple-grails-webapp
[delete] Deleting: /simple-grails-webapp/grails-app-files.jar
[move] Moving 1 file to /simple-grails-webapp
[move] Moving 1 file to /simple-grails-webapp
[move] Moving 1 file to /simple-grails-webapp
[copy] Copying 1 file to ~/.grails/1.1.2/plugins
Installing plug-in hibernate-1.1.2
[mkdir] Created dir: ~/.grails/1.1.2/projects/simple-grails-webapp/plugins/hibernate-1.1.2
[unzip] Expanding: ~/.grails/1.1.2/plugins/grails-hibernate-1.1.2.zip into ~/.grails/1.1.2/projects/simple-grails-webapp/plugins/hibernate-1.1.2
Executing hibernate-1.1.2 plugin post-install script ...
Plugin hibernate-1.1.2 installed
Created Grails Application at /simple-grails-webapp
Move to the directory of the newly created project and
create the Person
domain class
using grails create-domain-class.
$ cd simple-grails-webapp
$ grails create-domain-class Person
Welcome to Grails 1.1.2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails
Base Directory: /simple-grails-webapp
Running script /usr/local/grails/scripts/CreateDomainClass.groovy
Environment set to development
Created DomainClass for Person
Created Tests for Person
Create the Address
domain class.
$ grails create-domain-class Address
Welcome to Grails 1.1.2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails
Base Directory: /simple-grails-webapp
Running script /usr/local/grails/scripts/CreateDomainClass.groovy
Environment set to development
Created DomainClass for Address
Created Tests for Address
Create the PersonController
using
the grails create-controller command.
$ grails create-controller Person
Welcome to Grails 1.1.2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails
Base Directory: /simple-grails-webapp
Running script /usr/local/grails/scripts/CreateController.groovy
Environment set to development
Created Controller for Person
[mkdir] Created dir: /simple-grails-webapp/grails-app/views/person
Created Tests for Person
Create the AddressController
.
$ grails create-controller Address
Welcome to Grails 1.1.2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/local/grails
Base Directory: /simple-grails-webapp
Running script /usr/local/grails/scripts/CreateController.groovy
Environment set to development
Created Controller for Address
[mkdir] Created dir: /simple-grails-webapp/grails-app/views/address
Created Tests for Address