I've implemented this now... but its not working correctly.  I'm using Struts
2.0.9 (am aware of the new versions).

I have an AmountDTO which has a CurrencyCode (String), and a BigDecimal.

I have created an xwork-conversion.properties in the root of the classpath
which has the following line in it.

java.math.BigDecimal=example.BigDecimalConverter

The converter was not working at all with the
<ActionClass>-conversion.properties.

I lookup the current locale as follows

Locale locale = ActionContext.getContext().getLocale();
NumberFormat format = DecimalFormat.getInstance(locale);

If i turn on Debug, i can step through the convertFromString method, and the
correct value is assigned to the result.  The converter works!!! :) this is
a good thing.

However, after the converter - the AmountDTO.value in the action has null
set against it.  (value is a BigDecimal with appropriate getters and
setters)

What could cause this?  All I have changed is the converter, and its obeying
its contract correctly (and detecting the appropriate class, and returning
an appropriate instance)

Ideas?


Jeromy Evans - Blue Sky Minds wrote:
> 
> This should give you an idea. It's modified from existing code so I 
> haven't tested it.
> I've decided to use a collection of NumberFormat's.  You could use any 
> string -> decimal conversion technique you like.
> 
> This can be used to an action by created a 
> <actionname>-conversion.properties will in the same directory as the 
> class, with an entry:
> <propertyName>=example.DecimalConverter
> 
> where <propertyName> is the name of the property name that needs custom 
> conversion and <actionName> is the short class name of your action
> 

-- 
View this message in context: 
http://www.nabble.com/German-Turkey-etc-decimal-use-comma-in-input-fields.-tp15473083p15495155.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to