Hi, Recently in my project , i needed to validate an input (whether it is a integer or not) on client side. I tried many codes but they are bit lengthy. Then I encountered the simplest way as given below, which worked. For any input value, it checks whether it is an Integer or not. […]
Recently in my project we have use case where users have the habit of entering number as 100,000 and they write the -ve numbers as (100,000). Some times they also pur $ with the number field Initially when we were not aware of this we were populating the object like Expense expense =new Expense(params) This […]
Hi, In one of our projects, we had a requirement for using some existing Business Process Management tool. JBPM is one such tool that we are evaluating. Our first step was to run a “Hello World” process from inside the grails application. On searching over the internet, I didn’t find any helpful article/blog on integrating […]
Recently, in my project I had to implement search functionality. I used grails createCriteria to implement it.Now I needed to apply the sorting on the result returned. My domain was something like this : class MyEntity { OrganizationName orgName PersonName personName static constraints = { orgName(‘nullable’, true) personName(‘nullable’, true) } } class OrganizationName { String […]
It is very easy and handy to use Grails <g:uploadForm> tag insteed of using HTML <form> tag or grails <g:form> tag, as you don’t need to set the enctype attritbute to multipart/form-data (as in case of HTML <form> tag or grails <g:form> tag) to work with file upload. for example insteed of using: … ,We […]
XStream is a simple Java library to serialize objects to XML and back again. Suppose we have a Person class as follows: public class Person { private String name private int age private Address address } public class Address { private String street private String city private String state private String country } The following […]
Hi Friends, To retrieve difference between two dates with finer details which would display their difference as 2 years 7 weeks 3 days 2 hours 5 mins ago is given below. /** * Returns differnce b/w new Date and old date as Map holding difference in years, weeks, days, hrs, mins & secs */ public […]
I will try my best to give you some tips to make Vi look more interesting and easy to use for all you guys. I have read few articles and tutorials about Vi and will try to summarize some key points here. First things, first : WHAT IS Vi? Vi is NOT just an editor. […]
This post might help you if you want to get JSON (JavaScript Object Notation) Object on browser. Grails framework provides you very efficient way to achieve this. For this you need to import grails JSON convertor in your code. import grails.converters.JSON Below is the code snapshot which converts java based lists of Objects to JSON […]
Recently, I had to write a script to deploy a Grails application on a cluster of 7 servers without prompting for any kind of passwords. The load balancer was configured so as NOT to direct any request to the node, if the Apache process is not running on the server. So, my script to do […]
Hi Friends, I always used to spend lot of time writing integration tests as running even a single test involves loading the complete application, which includes loading complete database every time. Then I realized that data which I use for testing is always the same, why can’t we restore the database once created, before we […]
Recently had a requirement to print Currency values with a condition that negative numbers must be inside brackets. It can be done by using pattern property in tag. the part before semicolon is for positive numbers and part following semicolon is for negative number. ____________________ Hitesh hitesh@intelligrape.com Intelligrape Software ____________________