Grails Cookbook - A collection of tutorials and examples

Grails 3 Vue.js AJAX Table Examples

With all the popular JavaScript framework, I believe that Vue.js stands out as a powerful yet easy to learn framework. Other popular JavaScript framework have high learning curve. It takes weeks to understand and write simple stuff. Vue.js is a breath of fresh air because it provides excellent features yet it can be learned within minutes. In fact, I have written the example in this tutorial in less than 1 hour and having no prior Vue.js background. Here is an example on how to write in Grails 3 and Vue.js an AJAX table that displays records of a database table in paginated form.

Grails 3 Vue.js Hello World Examples

The release of Grails 3 coincide with the growing popularity of more modern Javascript frameworks. Gone are the days where we mostly write code in gsp and jQuery. Frameworks like AngularJS, React, Ember and others are gaining popularity. For beginners, I highly recommend Vue.js because it is very easy to learn like Grails. A developer with some experience will be able to grasps how to use it in minutes. But as always, the hard part is in getting started. How can our single page application interact with our Grails 3 back end? Below are some basic examples for beginners. Here are some Grails 3 Vue.js Hello World Examples.

Grails Tutorial for Beginners - HQL Queries (executeQuery and executeUpdate)

This Grails tutorial will teach the basics of using HQL. Grails supports dynamic finders which makes it convenient to perform simple database queries. But for more complex cases, Grails provides both Criteria API and HQL. This tutorial will focus on the latter.

Grails Tutorial for Beginners - Criteria API

This tutorial will show how to use Criteria API to search data from the database. Criteria is a powerful API and an elegant alternative to HQL.

Grails Tutorial for Beginners - Grails Service Layer

This tutorial will discuss the importance of the service layer in Grails and how to work with it. It also explains transaction management and how to utilize it.

Grails Tutorial for Beginners - Scaffolding

Scaffolding is a popular feature of web frameworks where a programmer can quickly create working components of a system to handle data manipulation. Code to handle create, read, update and delete operations (CRUD) for a specific table can be implemented or generated within several minutes only through the use of code generators or other shortcuts.

Grails Tutorial for Beginners - Display Data from the Database

The most common thing we want to do in Grails is to read data from the database and display it to the user. This post is a simple walk-through on how to accomplish this.

Grails Tutorial for Beginners - Form Submission and Saving Data to the Database

HTML Forms are usually used to gather data from users. This post will show how to make use of forms to save data to the database.
This example will render a form that looks like this:
zzzzz01
And on click of save, will save the data to the person table.

Grails Tutorial for Beginners - Introduction to GORM

GORM is half the reason why I use Grails as my default choice in implementing new projects. Using it just makes implementation of business logic a breeze. Working with a database becomes so easy.
GORM is Grails' object relational mapping (ORM) implementation, which sits on top of the very popular Hibernate framework. If you are familiar with Hibernate, then you can pick up GORM in an instant. Don't worry otherwise as GORM is straightforward and easy to learn.

Grails Tutorial for Beginners - Layout Templates

When coding screens, there are many elements that are common and repetitive. Usually the header, footer, and sidebars stays the same and only the content at the middle of the screen that change. The best approach is to have your GSP page contain only the specific business content, and have the repeating content re-factored outside. Grails supports layout templates for this particular purpose.