getText returns NULL when formating number using l10n

2011-11-21 Thread Felipe Issa
Hi. I'm trying to internationalize my application, and for that i need to use the struts l10n. I have managed to parse the number according to the user locale, but I'm having some troubles to display the number using the user locale. On Struts 2 documentation it says: "to input a number, one

Re: getText returns NULL when formating number using l10n

2011-11-21 Thread Li Ying
I have read the source of java.text.MessageFormat, looks like it output a "null" text to the result String when the argument is null. I think you can create a read-only property in your action (or your data model class), and implement the null check and format process in this property, code like:

Re: getText returns NULL when formating number using l10n

2011-11-21 Thread Li Ying
or you can do the null check in the jsp code, before you create the param list for the format string. Code like: 2011/11/22 Felipe Issa : > Hi. I'm trying to internationalize my application, and for that i need to > use the struts l10n. I have managed to parse the number according to the > us

Re: getText returns NULL when formating number using l10n

2011-11-22 Thread Felipe Issa
It's not a definitive solution, but it works. Thanks Li Ying! Em 21/11/2011 23:07, Li Ying escreveu: or you can do the null check in the jsp code, before you create the param list for the format string. Code like: 2011/11/22 Felipe Issa: Hi. I'm trying to internationalize my application,

Re: getText returns NULL when formating number using l10n

2011-11-27 Thread Li Ying
If you want a definitive solution, i suggest you create a new method like: getTextEx(.) in your action, in this method, you can check the parameters, if they are null, change them to empty string, and then invoke the original getText method. you can put this method in the base class of you