charlie brown <charliesno <at> googlemail.com> writes:

> I am writing a tap 4 component and want to use the translated field support
> to convert the user input to an integer.
> However when I enter a numeric value into the field, the translator returns
> a Long, and I get a class cast exception when try to set it to a value.
> 
>  <at> Parameter(defaultValue = "translator:number")
> public abstract Translator getTranslator();
> 
> InjectObject("service:tapestry.form.TranslatedFieldSupport")
> public abstract TranslatedFieldSupport getTranslatedFieldSupport();
> 
> Integer dayInt = (Integer) getTranslatedFieldSupport().parse(this,
> dayValue);

Try:

Integer dayInt = 
  new Integer(
    ((Number) getTranslatedFieldSupport().parse(this, dayValue)).intValue());

--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to