import java.text.SimpleDateFormat
long lTime = new Date().time
String formattedDate = getUTCDateString(lTime)
println formattedDate
def getUTCDateString(long lTime)
{
Date lDate = new Date(lTime)
def cal = new GregorianCalendar(TimeZone.getTimeZone('UTC'))
cal.set(lDate[Calendar.YEAR],lDate[Calendar.MONTH],lDate[Calendar.DATE],lDate[Calendar.HOUR_OF_DAY],lDate[Calendar.MINUTE],lDate[Calendar.SECOND])
String formattedDate = new SimpleDateFormat("yyyy-mm-dd hh:mm").format(cal.time);
return formattedDate
}
Learnings GRAILS, AJAX
Friday, March 19, 2010
Tuesday, March 9, 2010
Groovy String to Integer
Converting a String to Number
String nbrStr = "100"
int i = nbrStr.toInteger()
assert i==100
String nbrStr = "100"
int i = nbrStr.toInteger()
assert i==100
Tuesday, November 25, 2008
Examples of AJAX Elements in Grails
I am very impressed with the rapid development Grails Offers, the power of AJAX which grails offers has made it even more powerful. Grails offers many AJAX frameworks which can be added as plugins.
Grails also offers some built in functionalities, with
For other attributes and more details look at the grails documentation.
Lets look at example of each one,
1. g:remoteFunction
Use g:remoteFunction to populate comboboxes, RadioButtons with the values recieved by invoking a function/action on the Controller,
Check the Example out on JAN Blog
2.
Grails also offers some built in functionalities, with
- g:remoteFunction
- g:formRemote
- g:remoteField
- g:remoteLink
- g:submitToRemote
Following are common attributes of mentioned tags following are really useful:
- controller - name of the controller to use
- action - name of the action within controller
- update - element to update or map containing elements to update in the case of success or failure
- params - parameters to send with the call
Attribute that really enables AJAX behavior is value of update attribute. Content of the page placed between
div id="value_of_the_update_attribute"For other attributes and more details look at the grails documentation.
Lets look at example of each one,
1. g:remoteFunction
Use g:remoteFunction to populate comboboxes, RadioButtons with the values recieved by invoking a function/action on the Controller,
Check the Example out on JAN Blog
2.
Subscribe to:
Comments (Atom)