2009-11-16 124 views
1

我正在开发一个groovy应用程序,并且在显示Date字段时遇到问题。Groovy日期格式问题

如果我使用了下面的符号:

<g:formatDate format="dd.MM.yyyy" date="${fieldValue(bean: incidentTicketSLAInstance, field: "erstellungsDatum")}"/>      

我得到的实际日期,而不是什么被保存在数据库中。

当我使用这种表示法时,它工作正常。

<g:formatDate format="dd.MM.yyyy" date="${incidentTicketSLAInstance?.erstellungsDatum}" /> 

我在这里做错了什么? 这两种符号是否相同? (顺便说一句,在执行个体存在,erstellungsDatum不为null)

由于提前,

路易斯

回答

1

的fieldValue方法调用将返回一个字符串,而不是一个Date对象,该品牌formatDate不行正确

你必须使用第二个符号(如你发现)

+0

谢谢您的回答,路易斯 – Luixv