struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Issa <>
Subject getText returns NULL when formating number using l10n
Date Mon, 21 Nov 2011 17:04:31 GMT
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 might have noticed that the number is always 
shown in the Java default number format. Not only that this is not 
"nice", if you are in a non-en locale, it will also cause trouble when 
submitting the form since type conversion is locale aware. The solution 
is to again use the message formats as defined above, by using the 
getText Method of ActionSupport:

<s:textfield key="orderItem.price" 
value="%{getText('format.number',{orderItem.price})}" />

This maps to the method signature getText( String key, Object[] params ) 
in ActionSupport."


It display the number in the correct format when i use the value like 
this, but when the value is null it shows "null" instead of a empty 
textfield. Does anyone know how to fix it?

Thanks in advice!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message