This tutorial will show how to create two select boxes where the second select box's items are affected by the value of the first one. Developers encounters this commonly and it is also called chained select. An example is selecting a country, followed by selecting a state. The choices for states should be based on which country was selected.
This tutorial will show how to use an external properties file to configure the datasource of a Grails application. Hardcoding database properties should only be limited for development purposes. But when deploying an application to another environment (E.g. test, UAT, production), it is usually convenient to be able to change things freely.
This tutorial will show how to generate PNG images on the fly and display inside a GSP. This can serve as a basis on how to create a more complex behavior. For example, creating report graphs for display in your applications.
I was searching for a way to hook business logic after successful user login while using Spring Security Core plugin. The simplest way to do this is to register callback closures. It let's you hook your custom code inside Config.groovy after certain Spring Security events.
The most common way to configure database access in Grails is to hard code the connection properties inside Datasource.groovy. This is great for development purposes. But for production, we want a flexible way where admins can change which database to connect to, without needing to recompile the application.
The standard way of doing this is to leverage JNDI. We configure the database connection in the application server, and pass it to our Grails application. Below is an example on how to do it with Tomcat.
Sometimes it is very helpful to execute some code depending on which environment you are in. For example, you may want to insert test data inside Bootstrap when you run the application in development mode, but not in production mode.
This is simple in Grails on different sections of your application.
In the old days, the common way of adding external libraries to a Grails project is by adding the JAR files in the lib folder of your application. This method is easy and simple. But the more modern and recommended way is to utilize BuildConfig.