If you have an open command prompt from running runMeFirst.bat while setting up Composition on Grails on NW CE, then you can skip steps 2 & 3 and continue to use this command prompt for the rest of the tutorial.
Go to the Grails folder C:\workspace\grails1.0.
Run RunMeFirst.bat. This should open a command prompt in C:\workspace\grails1.0\cog-apps folder. Alternatively, you can use "External Tools" in Eclipse for running grails commands instead of using the command prompt.
Don't close the command prompt as you have to use it for entering commands throughout the tutorial.
Create a Composition on Grails application.
Create a domain class.
Edit the domain class "Book" that you created. You'll find it in grails workspace\cog-apps\MyFirstApplication\grails-app\domain. (This is in the file system and not on cmd, you can use any text editor for the same.)
Now paste the following block of code into the Author domain class.
Go back to command prompt and generate the Web Dynpro controllers and views.
Generate dev.html. This file is used at design time to see changes at the page reload.
Click on dev.html (in workspace\cog-apps\MyFirstApplication) to see your first Composition on Grails application.
Avoid instantiating portal specific objects such as "logged in user" as member variables. If not properly declared, they will cause failures in development mode (dev.html).
Now that you have a running application, you can modify it to make it more interesting. If you create something really cool and you're willing to share, let us know.
You can change any of the generated controllers and views found in C:\workspace\grails1.0\cog-apps\yourApplication\grails-app\wdcontrollers according to your needs.
You can add non-UI business logic to the services folder found in grails-app.
FAQ for creating CoGs Application
When I click on dev.html it gives me a "Page cannot be displayed" error.
Go to your Composition on Grails application directory, e.g. C:\workspace\grails1.0\cog-apps\MyFirstApplication. You should find a cogConfig.properties file here. Right click and open this with a text editor. Make sure that the http protocol port number listed here matches with the http port number in CE. To check this, go to the SAP Management Console, CE and under the J2EE server, go to Access Points and make sure that the port number for HTTP protocol matches what is specified in cogConfig.properties. If not, update cogConfig.properties with this port number and run the cog-generate-html script again.
The changes I made to my domain class don't seem to be reflected in the UI in my application.
In your application, right click on any controller and open in new window. Then in the address bar of your browser, at the end of the present URL type &reload=true . This would force a compilation of all the groovy files in your application.
When I do reload=true it cleans up my database.
Grails by default is set to use HyperSonic database which is a in-memory database. You can set grails to use MySQL if you wish to keep your database intact.
I'm running in dev mode (using dev.html) and the CE server keeps going down.
Most likely there is a syntax error in the code which is not deployed to the j2ee engine. Workaround: deploy your application, this will throw the correct error or debug. Once you fix the errors, you shouldn't have the problem anymore.
This is not my first application, is there something different that I need to do?
If its your second or later application, you should launch a command prompt using RunMeFirst.bat. Please note that using setUp.bat would regenerate grails.sda before launching the command prompt. This isn't required unless you have new additional libraries added that are not yet deployed.