开发者

How to use g:datePicker in grails gsp to pick a time?

By using g:datePicker on java.sql.Time object that refers to a TIME legacy DB column I get this error:

Failed to convert property value of type java.util.GregorianCalendar to required type java.sql.Time for property jobTime; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.GregorianCalendar] to required type [java.sql.Time] for property jobTime: PropertyEditor [org.cod开发者_C百科ehaus.groovy.grails.web.binding.StructuredDateEditor] returned inappropriate value

I've searched through the whole web for hours but can't still figure out how to do, is there someone who can help please?


It looks like you're trying to convert a GregorianCalendar object to a Time object (at least, that's what the object says its doing). Try manually doing it:

// assuming that 'jobTime' is the object you're dealing with
jobTime = new java.sql.Time(jobTime.getTimeInMillis())

If you're absolutely sure its a Time object, try converting it to a Date object.

jobTime = new Date(jobTime.getTime())
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜