Hello Ned,

I use my own tag - bean:format, which uses locale from session to
print number and date values. It can be extended without problems to
support currency printing. So it can use format string from special
parameter and print values on special manner. I can send it to you.

Tuesday, December 12, 2000, 2:12:08 AM, you wrote:


NS> Just wondering if there is anyway I can get access to the session Locale 
NS> from within a bean property get function?

NS> Reason? I'm defining a money object, it has a value and currency. I want to 
NS> display this on a page via a <bean:write>

NS> Only problem is that each different locale may have a different way of 
NS> displaying a certain currency value. Fine, I can format these with the 
NS> format class from inside my bean getDisplayvalue class, but I cannot think 
NS> of a way of getting a hold of the session locale to do the translation.

NS> The only other way of doing this I can think of is along these lines 
NS> (forgive me, I'm nowhere near any docs at the moment and it's late)

NS> <bean:message key="<bean:write id="currency_val" property="displaykey"/>" 
NS> arg0="<bean:write id="currency_val" property="value"/> />

NS> Which is:
NS> a) pants. Overblown. Difficult to explain that to our html designers. I dont 
NS> want to keep fixing their code!
NS> b) Not going to work I don't think. How do we deal with locale sensitive 
NS> number formatting at the moment? How can I get the object value into arg0 
NS> rather than a text version of it?
NS> c) probably quite slow. I wouldnt want to call the message formatter every 
NS> time with string that contains the number format quite slow? I mean parsing 
NS> that {0,number,###.000} everytime must be a little tedious?

NS> On the other hand, is there some way I can make bean:write call a function 
NS> like getDisplayvalue( Locale currentLocale ) easily?

NS> or can I write the locale into the threadlocal storage?

NS> or any better suggestions anybody?
NS> 
_____________________________________________________________________________________
NS> Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com



-- 
Best regards,
 Oleg                            mailto:[EMAIL PROTECTED]


Reply via email to