Here is a simple way to use the GSP from Grails to build reusable templates from files coming from the outside of the application (for mails, files exports, etc. …)
The first step is to create a GSP which defines the template. It should be noted that no special tag will be interpreted this way. Here is a sample VCARD file to import a contact (_vcard.gsp) :
BEGIN:VCARD
VERSION:2.1
N:${people.lastname};${people.firstname};;${people.civility}
FN:${people.civility} ${people.firstname} ${people.lastname}
TITLE:${people.job}
TEL;WORK;VOICE:${people.professionnalPhone}
EMAIL;INTERNET:${people.email}
END:VCARD
Then we must add a small method that will link the template to the data through the Groovy’s template engine :
(Lire la suite…)
