Hi Kent,
Currently I am just doing the same as what you have suggested.
Thanks.
Best Regards,
Vincent
On 12/17/05, Kent Tong <[EMAIL PROTECTED]> wrote:
> Vincent <vincent82 <at> gmail.com> writes:
>
> > Here the defined type is Long ,cause I don't want the default value 0
> > of long displayed in the field. Long will initial null for the default
> > value , then this can solve above problem , but when later you want to
> > get the long if nothing is inputted then the following
> > <code>
> > Long.longValue()
> > </code>
> > method it will throw null pointer exception. If you initialized before
> > , then it will display a default value for that.
>
> If possible, use Tapestry 4 whose NumberTranslator has an omitZero
> property which serves exactly this purpose.
>
> If you must stick to Tapestry 3, you may create a wrapper component
> around the NumericField:
>
> <parameter name="value" type="java.lang.Number"/>
> <component id="numericField" type="NumericField" ...>
> <binding name="value" expression="value2"/>
> </component>
>
> Number getValue2() {
> if (getValue() != null && getValue().getDoubleValue() == 0) {
> return null;
> } else {
> return getValue()
> }
> }
>
> --
> 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]