Yes... Thanks, that what I tought....

The problem is that my Pojo object is in fact created by Castor (from an
xsd), and Castor always create "Integer" even if we specify "xs:int" in the
xsd...
Castor add a method call has[name of the field] to replace the null value.

I guess I will have to write my own implementation of PropertyModel that
will handle that.

Thierry


On Wed, Jan 27, 2010 at 10:50, Johan Compagner <jcompag...@gmail.com> wrote:

> an int (primitive) is always required.
> We have to set it to something. cant be null
> if you want to be able to not require it (so null) make it an Integer not
> int
>
>
> On Wed, Jan 27, 2010 at 16:48, Thierry Leveque <tleve...@gmail.com> wrote:
>
> > Here's what I have in my code:
> >
> > TextField<Integer> lAdaptingHitCountThreshold = new TextField<Integer>(
> > "AdaptingHitCountThreshold", new PropertyModel<Integer>( lMcsConfig,
> > "Adapting.HitCountThreshold" ) );
> >
> > lForm.add( lAdaptingHitCountThreshold.setRequired( false ) );
> >
> > But when I execute it, if I do not enter any value in the field, I keep
> > getting the message "Field 'AdaptingHitCountThreshold' is required."
> > Why? In my pojo data object (lMcsConfig), the field is really of type
> > "int",
> > but it is not required.
> >
> > Is there a simple way to make this work? Other than creating my own
> model?
> >
> > Thierry
> >
>

Reply via email to