-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Laurie,

Laurie Harper wrote:
> Without thinking about it very much, I would expect that one or other of
> these would work:
> 
>   <bean:write name="user" property="country.population" />
>   <bean:write name="user.country" property="population" />

Regardless of the method of output, your code needs to both read and
write the date in the same format.

If the date will be shown to the user, formatting in their locale is
appropriate. If the date will not be shown, I always recommend ISO-8601
date formatting.

I have a similar situation in that I need to allow users to specify
their own date format preferences. I keep their formats in a Map in the
session, and I wrote a custom validator to validate dates against those
formats. My forms contain only Strings, so in the form handler action, I
use those same formats to create a new SimpleDateFormat object and parse
the date.

I find that non-String form fields often results in conversion problems
like this. They are difficult to debug, too, since the error messages
are usually something along the lines of "field 'foo' is invalid", but
you aren't sure why. Unless you hack the code, you'll never find out
what's going on. If you use Strings, you can always disable validation
and start printing things out in your actions to help you debug.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF9WIM9CaO5/Lv0PARAmMdAJ4lp3o4dbs/c3OGWwr57s/VNr1+NgCgqGmB
pWQ64zY+1t+Hw8DJghB7lAc=
=EqKm
-----END PGP SIGNATURE-----

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

Reply via email to