struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas <andr...@muha.net>
Subject Re: User (session) specific number formatting which overrides Locale
Date Sat, 14 May 2016 01:14:06 GMT
Thank you Christoph,
that sounds like something I could try out.

I was on the verge on implementing my on s.text-tag...

Regards


On 2016-05-13 16:41, Christoph Nenning wrote:
>> Hello!
>> I understand I can support different locale for users using the 
>> I18nInterceptor and the request_locale parameter.
>>
>> Is there a similar solution for "Number Formatting"?
>>
>> A number of users have expressed they wish to see 4 decimals instead of 
>> only 2, and I can not find a good solution for this that only works for 
>> this subset of users.
>>
>>
>> One idea I had was to set the number-format in a session, and then use 
>> it (if it exist) for number formatting. But despite experiments, this 
>> does not seem to work :/
>>
>>
>> Anyone have an idea what I can do?
>>
> Hi,
>
>
> in our apps we use user locale specific formatters for a lot of things 
> including numbers, dates, times, currency, ...
>
>
> Usually we have an java object on ValueStack (can be in a base class for 
> all actions or in a dedicated class placed on stack by an interceptor) 
> which provides methods in the form:
>
> formatDate(Date)
> formatTime(Date)
> formatInteger(Long)
> formatDouble(Double)
> ...
>
> Those methods can pickup the locale from several places, including 
> HttpSession.
> They are invoked from JSPs via OGNL expressions.
>
> Hope this helps,
> Christoph
>
> This Email was scanned by Sophos Anti Virus
>


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


Mime
View raw message