Apache Wicket : How to do the mapping between checkbox and backend values right?

34 Views Asked by At

I use CompoundPropertyModel to map the backend values to model on a Map used in my Form.

It's OK for text who doesn't change between the 2 steps. But for a CheckBox, i need to map True<->"1", False<->"0".

I'm not sure what is the cleanest way to do it :

  • on read/write backend ?
  • IConverter ?
  • setType() ?
  • another solution i didn't see in javadoc ?

I have to say i'm a bit lost around when to use the differents way...

Thanks for the infos.

1

There are 1 best solutions below

0
martin-g On

I'd use the simplest one that works for my use case, probably setType() for you. If the use case evolves to something more complex then I'd look into the alternatives that give me better control on the conversion of the "String" request parameters to my backend types.