The Grails elseif tag (<g:elseif>) tag is used together with the if tag (<g:if>) and optionally with the else tag (<g:else>). The elseif is used if there are more than one test that needs to be performed. Here is a simple example on how to use this tag.
The Grails else tag (<g:else>) tag is used together with the if tag (<g:if>). The else portion is rendered when the if part failed. This is used to have conditional statements inside a GSP. This is useful if we want to display a certain view code or another depending on some condition. here is a simple example on how to use the Grails else tag.
The datePicker tag (<g:datePicker>) can be used to render an HTML for date input. It may render the input components for the day, month, year, hour and second. What is rendered can be controlled depending on parameter used. here are some examples:
The Switch statement in Groovy is more powerful than in Java. There are things that are easy to do in Groovy switch statements that are not available in Java. It is also more concise and easier to read. Below are several examples on how to use Groovy switch statements.
A list is a common data structure that is used to store a collection of data. This can be used to store varying amount of data where the number of items is only determined at run time. Or it can also be used to store large amount of data where having different variables for each is not practical. Below are examples on how to use and manipulate List in Groovy.
Getting a substring from another String is one of the basic building blocks of String manipulation. Most programming languages supports it out of the box. In Groovy, there are some cool ways of how to perform this operation. Below are some examples on different ways of getting substrings in Groovy.
Maps are very useful in programming. It can be used to cache results of expensive operations to help improve performance. One of the basic operation in maps is how to add entries to it. Below are some examples on how to Add or put values to a map in Groovy.