Joda time and the Datebox-component

asked 2008-06-26 12:53:06 +0800

admin gravatar image admin
18691 1 10 129
ZK Team

Orignial message at:

By: gekkio


I'm trying to bind an entity bean attribute to a Datebox, but the entity bean uses Joda time which is not supported by Datebox.
It's obvious that I need a TypeConverter to manage the Date<->DateTime object conversion.
I created one but it doesn't seem to work at all. Binding other bean attributes work perfectly, so I think my binding configuration is fine.

Here's my TypeConverter:

public class JodaTimeZkConverter implements TypeConverter {
public DateTime coerceToBean(Object val, Component comp) {
if (val instanceof Date) {
return new DateTime(val);
throw new UiException("Converter expects a Date/DateTime object");
public Object coerceToUi(Object val, Component comp) {
return null;

Here's the ZUL fragment:

<datebox value="@{bean.startDate, converter='mypackage.JodaTimeZkConverter'}"
constraint="no empty" />

I did some debugging and confirmed that the converter gets called with proper parameters (val is the Date object I selected in the Datebox).
coerceToBean() returns the relevant DateTime, so it should work and set the bean attribute (?).
However, the entity attribute is never set.

Some facts:
- I'm using public fields in the entity bean instead of getters and setters
- The ZK version is 3.0.5
- I'm using annotation binding (but as I said, binding other attributes such as String values works perfectly).
- There are no error messages that would reveal any mistakes
- coerceToUi is a stub implementation because it's not needed at this point
- I'm upgrading to 3.0.6 as soon as it hits the maven repository (I didn't find any bug fixes that could be related to this, so it probably doesn't matter

Am I missing something or doing something completely wrong?

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2008-06-26 13:41:35 +0800

admin gravatar image admin
18691 1 10 129
ZK Team

Orignial message at:

By: gekkio

I finally solved the problem.
After 2 hours of banging my head against the wall I found the typo which caused the problem :) I'll release later some of my useful ZK classes under GPL.
Please forget this post.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2008-06-26 12:53:06 +0800

Seen: 331 times

Last updated: Jun 26 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More