I don't have time right now to investigate the possible solutions to
your problem using the approach you're following.  I just wanted to
point out that FormDef might be able to help you out depending on how
you're using your action form.

http://www.rabago.net/struts/formdef/manual.htm#specifyingformats

Using FormDef, you can specify localized formats for dates and
numbers.  There is a sample application (locale.war) that illustrates
this feature.

Hubert

On Apr 3, 2005 7:04 AM, Bernd Hofner <[EMAIL PROTECTED]> wrote:
> Is there a way to persuade Struts to use the default Locale to populate
>  ActionForms?
> 
> Tracing the code I saw the the RequestProcessors processPopulate()
> method ends up using the setProperty() methods of the BeanUtil class.
> This one is not using the Xy-Format classes to parse HTTP form entries,
> but instead just uses non-locale aware conversion functions (like
> Double.valueOf(string ...).
> 
> This is quite annoing as my (German) users certainly will expect to
> enter their numbers using a "," as a decimal point.
> 
> The commons-beanutil.jar conains another set of utility classes that
> seem to be locale aware (starting from the entry point class
> LocaleBeanUtil).
> 
> How do I get Struts to uses these classes?
> 
> I tried a custom RequestProcessor with an overloaded processPopulate()
> method that replaces the call to BeanUtil.populate(...) with
> LocaleBeanUtil.populate() but I had the feeling that the thread-local
> singleton construction mechanismn created a BeanUtilsBean instance
> instead of a LocaleBeanUtilsBean.
> However, the ActionForm is still not populated in the desired way...
> Needless to say that I checked that both the Locale.getDefaultLocale()
> and the LocalBeanUtil.getDefaultLocale() are actually set to DE-de.
> 
> What am I doing wrong? I suspect that I'm actually thinking to
> complicated. I guess the Struts framework has a little switch somewhere
> to tell it wich kind of locale to use for form poplulation...
> 
> Thanks for yours help!
> 
> Amarookie
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to