0

I've got this JSF APP, using postgresql 9.2, java7 and tomcat7

I developed the application under a windows7 64 bits (eng) enviroment. The application, will be running under a windows7 32 bits (pt_br).

The problem is... When I run the application under win32, the jsf converter seems not to work.

It gives me the following error:

javax.el.ELException
Caused by: javax.el.ELException: Error reading 'precoVenda' on type com.model.Produto
Caused by: java.lang.NumberFormatException: For input string: "4,5"

As far as I can imagine, it seems the jsf native converter is not doing it right.

Also, when I save something on my app in the win32, it converts my 4.5 to 4 One more thing i've noticed, is the inputText value: in win32 it shows comma: 4,0 While in the win64 it shows dots: 4.0

Anyone have any idea about what is going on?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Alan Lanzoni
  • 53
  • 1
  • 4
  • 1
    When you change language of system, different countries use different characters for decimal separator, for most it's `.` but some use `,`. That's probably the case here. – Geinmachi Sep 20 '15 at 08:40
  • oh... i didnt know that. I'll check it out. Thnx – Alan Lanzoni Sep 20 '15 at 08:43
  • [Here](http://stackoverflow.com/questions/24616848/get-number-format-from-os) is one thread about how to get system specific decimal separator. – Geinmachi Sep 20 '15 at 08:44
  • BTW exception say clearly what is problem, IMHO. Usually I use s = s.replace(',', '.') before parsing - in Polish e-situation Locale conventions are mixed and not always used – Jacek Cz Sep 20 '15 at 08:44
  • I've corrected the error. It happened that the problem was with the windows version. – Alan Lanzoni Sep 21 '15 at 22:47
  • Continuing... The decimal separator character were different. Even changing the number format, like Geinmach said, didn't work, because since java 7, the locale is gotten from language display, not from number formats. It seems it has have some changes in java 8. The solution, was to se the locale programatically. Even the f:view tag didn't work. But anyways, thnx for pointing the way. – Alan Lanzoni Sep 21 '15 at 22:53

0 Answers0