Back Forum Reply New

Custom tag

Hi,

I'm relatively new to Spring (1 month) and I'm really enjoying this framework. It just works.

But now I have a question. I'm using spring quot;formquot; taglib. It's really nice and covers most of the things I need but one.I'm using a CustomNumberEditor for getting numbers into beans and for writting numbers into pages, everything in a locale sensible way. It works nice to output numbers in inputs and textareas, etc.

lt;form:input path=quot;propertyquot; /gt;

The app is being used by spanish people, and the number format is like this:

100,23

instead of the american one:

100.23But In some places I just need to output text, not an input element or a textarea.

I know I can use EL to output values like ${bean.property} but those numbers are not localized because don't use the CustomEditor.

How can I do this with Spring tags?

I'm looking for the equivalent of the struts lt;bean:write name=quot;propertyquot;/gt;Thank you for your time and sorry for my bad english.

JSTL already has a library for that. Check the FMT tag library which can do formatting for you.

That's a good solution.

But it could be better if it was a spring tag.

With fmt tag I use:

lt;fmt:formatNumber value=quot;${number}quot; groupingUsed=quot;truequot; minFractionDigits=quot;2quot; maxFractionDigits=quot;2quot; /gt;

With the lt;form:inputgt; I just declared a CustomEditor and every number value gets formated.
¥
Back Forum Reply New