TO THE NEW Blog PAGES

Grails

Grails Pdf Viewer Plugin

In one of our recent Grails project we had to provide support for Viewing Pdf even if end user’s browser did not have any pdf viewer plugin or add on installed. So we decided that we would open our pdf on Google Doc’s pdf viewer. This will behave in same manner as Gmail does , […]

Hitesh Bhatia
Hitesh Bhatia
Read

Grails

Grails Liquibase plugin: dbDiff tool workaround

The current project I am working on, is going through QA. At the same time development of the new features and bug fixing is on and we couldn’t afford to loose the test data. So synchronizing the state of the QA database with the development was becoming a pain. So we decided to use grails […]

Amit Jain
Amit Jain
Read

Grails

Grails way for rendering the GSP templates: The tmpl namespace.

Today while working on a project, I paired up with my colleague (Uday)  and we found that we can render a gsp template in a different manner also. Grails provide us a “tmpl” namespace for rendering the GSP templates. The old way that we use to render a gsp template The other way for  rendering […]

Grails

GORM Batch Deletes Made Easy with Load Method

We are using the grails asynchronous mail plugin in our project and noticed that the sent mails never gets deleted from the database. This was an issue because we were sending out a lot of mails and all of them had PDF attachments of about 500 KB to 1 MB each. A sure recipe for […]

Vivek Krishna
Vivek Krishna
Read

Grails

Gorm default configurations in config.groovy

Recently while working on my new Project I have the requirement where each domains need to have dateCreated and lastUpdated fields. So rather than adding these fields to each of the domain class we added them to template. Now whenever we create a domain class these two fields are added to it automatically. Next thing […]

Grails

GORM dirty checking of instance and properties

Again I am going to showcase few useful methods that GORM provides us to check whether the object is dirty or not (again from grails.org). First question could be what is a dirty object? An object is dirty if the current state of its properties does not match with its persistence values. It happens when […]

Grails

Changing the behaviour/Scope of Services in Grails.

Sometimes our services are so tightly bound with the Controllers that we actually think that a new Service instance should be get created on every request or the member variables in the services can be defined only for the current user. But by default the Services are “singleton” scoped which means that clients of a […]

Chandan Luthra
Chandan Luthra
Read

Technology

Passing parameters to sub-reports in Jasper

In one of our recent project, we made quite a good use of Grails Jasper plugin (v-0.9.7) to generate reports in the form of PDFs and Excel sheets. The reports contain sub-reports, which in many cases, contain sub-reports again. The way to pass parameters to sub-reports at the deeper level is to use the following […]

Abhishek Tejpaul
Abhishek Tejpaul
Read

Grails

Grails annotation – Validateable

We can easily validate domain classes and command objects using static constraints. But how about validating DTOs or any groovy class in src/groovy folder. The answer is YES, they can be validated too. Follow two simple steps: 1. Add annotation ‘@Validateable’ above the class. 2. Declare the package to be validated in Config.groovy as: grails.validateable.packages […]

Aman Aggarwal
Aman Aggarwal
Read

Grails

Grails pagination on a ArrayList

Hi all, In my recent grails project, i needed to paginate on an array list, so I wrote a function and thought would share it with you all. public List getFilteredList(int max, int offset) { max = Math.min(max ?: 25, 100) offset = (offset && offset>0) ?: 0 List names = getNames() //Loads the complete […]

Vishal Sahu
Vishal Sahu
Read

Technology

Asynchronous behavior of AJAX

Ajax (shorthand for Asynchronous JavaScript and XML) is used to retrieve data from the server asynchronously without interfering with the display and behavior of the existing page. Forgetting this asynchronous behavior will produce incorrect result if it depends on the response from Ajax call. Lets take an example(I am using JQuery to illustrate the example). […]

Bhagwat Kumar
Bhagwat Kumar
Read

Grails

Grails: execute sql script in Bootstrap

This blog might help you to speed up your bootstrap process, especially when you need to populate records in tables. Earlier we used populate our database table by reading line by line from a CSV file and creating Domain Class object ad Save. But this was taking a huge time. And in our case, this […]

Anshul Sharma
Anshul Sharma
Read