struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takhar, Sandeep" <Sandeep.Tak...@CIBC.ca>
Subject RE: Date validator and I18N
Date Wed, 14 Apr 2004 11:38:46 GMT
I have coded LocaleBeanUtils, but had to subclass the whole thing since it seems like it is
a version behind.  In the subclass I changed a couple of lines in some methods to make it
work with some converters I created.

Someone else has a solution that I haven't had time to look at yet: http://www.rabago.net/struts/formdef
that talks about formatting.

I had to have custom converters so the populate that struts uses from BeanUtils removes some
formatting as well so we don't have to deal with this in the action.

sandeep

-----Original Message-----
From: Joe Hertz [mailto:jhertz@speakeasy.net]
Sent: Tuesday, April 13, 2004 10:51 PM
To: 'Struts Users Mailing List'
Subject: RE: Date validator and I18N


Yes, you can get the dates validated this way, but isn't actually the
tough hurdle.

You've got Date objects being stored some place.

You'll need them displayed as Strings in your Action Form. You'll need
them formatted by Locale.

You'll want want the Strings converted back to Dates in the processing
Action. You'll need them parsed by Locale.

Unless someone can offer a better explanation of the usage of
LocaleBeanUtils than I can, this may prove to be quite the annoying
little repeated task.

-Joe

> -----Original Message-----
> From: Jeff Caesar [mailto:jcaesar@callidussoftware.com] 
> Sent: Tuesday, April 13, 2004 7:04 PM
> To: Struts Users Mailing List
> Subject: RE: Date validator and I18N
> 
> 
> I haven't personally tried doing this, but according to the 
> doc you can specify language/country/variant on the formset 
> when defining your validation so that the validator will 
> choose the best one available for the given user's locale.
> 
> From the validator DTD:
> <!--
>       The "formset" element defines a set of forms for a 
> locale. Formsets for
>       specific locales can override only those fields that change. The
>       localization is properly scoped, so that a formset can 
> override just the
>       language, or just the country, or both.
> -->
> <!ELEMENT formset (constant*, form+)>
> <!ATTLIST formset language CDATA #IMPLIED>
> <!ATTLIST formset country CDATA #IMPLIED>
> <!ATTLIST formset variant CDATA #IMPLIED>
> 
> So you would want to create four different <formset> defs 
> (one for each of your languages plus a default) for the form.
> 
> Jeff
> 
> -----Original Message-----
> From: Stjepan Brbot [mailto:stjepan.brbot@ht.hr] 
> Sent: Tuesday, April 13, 2004 3:07 PM
> To: user@struts.apache.org
> Subject: Date validator and I18N
> 
> 
> In my web application I deal with three languages (Croatian, 
> German and English). Application does have forms allowing 
> user to input a date value. When english locale is active 
> user must have the ability to insert date in english date 
> format (mm/dd/yyyy), also croatian and german users must have 
> the ability to insert dates in their own date format 
> (dd.mm.yyyy). How to define a validation for such a 
> situation? In mask for date validation (in validation.xml) I 
> can define only one date format pattern!
> 
> Stjepan Brbot
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message