I did something similar, converting a boolean radio to the Dutch words "Ja"
and "Nee" (yes / no).
This is the code:

public class JaNeeToBooleanConverterModel extends Model {

    private IModel wrappedModel;

    public JaNeeToBooleanConverterModel(IModel model) {
        wrappedModel = model;
    }

    @Override
    public Object getObject() {
        Boolean b = (Boolean)wrappedModel.getObject();
        return b.booleanValue() ? "Ja" : "Nee";
    }

    @Override
    public void setObject(Object object) {
        Boolean value = "Ja".equals(object) ? Boolean.TRUE : Boolean.FALSE;
        wrappedModel.setObject(value);
    }
}

2008/1/15, Mead Lai <[EMAIL PROTECTED]>:
>
>
> Hi, Well,I am use MySql, and there is no boolean type in mysql database.
> so I use Char(1) in the database, and in html I use CheckBox.but CheckBox
> only contain Boolean type.
> How to solve this problem? Use IConverter interface? Thanks
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29

Reply via email to