Pergunta

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

Foi útil?

Solução

No that's no bug. The fieldValue tag converts the passed property to a String and also does a HTML encoding. This means the response cannot be formatted as a Date simply because its a String.

Only your first snippet passes the raw date:

<g:formatDate date="${merchantTrans.dateCreated}" />

It it worked prior Grails 2.0 this may have been a defect.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top