On 11/3/05, Yujun Liang <[EMAIL PROTECTED]> wrote:
> Hubert,
>
> Good morning! ( Since I am sending it from Australia.)

Good morning!

> How can I convert an input from user to the Date field base on the Locale?
> I mean the locale is a varible during the session and conversion can
> handle multiple locales.
> Sorry for asking this, but in a locale aware web application, the
> input is based on Locale
>
> For example, in US, enter 10/12/2005 it will be converted to October
> 12, 2005 and this is December 10, 2005
> if the locale is Australia. How the global converter handles this?

Instead of the format itself, you can specify a key into your
application resource files:

        <!-- define the default format for use by all Date fields -->
        <global-converter for="property-type"
            target="java.util.Date"
            key="format.date"/>

In your resource files, define the format you want to use for that locale:
in example.properties (default for Aus?):
format.date=dd/MM/yyyy

in example_en_US.properties:
format.date=MM/dd/yyyy

The binary download for FormDef includes locale.war which demonstrates
this capability.

hth,
Hubert

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

Reply via email to