In my Grails 2.0 the following GSP code works:
<g:formatDate date="${merchantTrans.dateCreated}" />
But the code
<g:formatDate date="${fieldValue(bean: merchantTrans, field: 'dateCreated')}" />
causes the following error:
Stacktrace follows: Message: Unknown class: org.codehaus.groovy.grails.web.util.StreamCharBuffer
I tried different combos of single and double quotes but got the same error. This code worked in Grails 1.3.7, so ? There, I actually got away using double quotes on dateCreated as well as on date=”…”.
If you have a moment, can you please test a dateCreated field in one of your domain objects to see if you get the same thing. Perhaps I have some other update-to-Grails 2.0 problem that I’m unaware of?
In case it matters, I iterate over the merchantTrans objects as so:
<g:each in="${merchantTransactionInstanceList}" status="i" var="merchantTrans">
Thanks, Ray
No that’s no bug. The
fieldValuetag converts the passed property to aStringand also does a HTML encoding. This means the response cannot be formatted as aDatesimply because its aString.Only your first snippet passes the raw date:
It it worked prior Grails 2.0 this may have been a defect.