• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Invalid number specified in a numeric field

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Spring Coderanch Ranchers!

I'm looking for some work-around suggestions for the following problem. Lets go on.

There is a properties file named message.properties, one line in the file contained the text

typeMismatch.int=Invalid number specified in a numeric field



There is a file named enterhours.htm, the file displayed in the browser shows a page with the following table, where the numbers are in input-text fields displayed:
(for the decimal values colons "," - not dots "." used)

| Period Ending: Juni 20, 2010
| Deparment |---Mo---|---Tu---|---We---|---Th---|---Fr---|---Sa---|---Su---|---Total---|
|--------------|--8,00--|--8,00--|--8,00--|--8,00--|--8,00--|--,00--|--,00--|--40,00--|

There is a button "SAVE", on the page. When it is clicked, the page returned in red (well, well ,well in red):

Invalid number specified in a numeric field
Invalid number specified in a numeric field
Invalid number specified in a numeric field
Invalid number specified in a numeric field
Invalid number specified in a numeric field
Invalid number specified in a numeric field
Invalid number specified in a numeric field

In the file enterhours.jsp is used, the c and fmt JSTL and additional spring. The following snippet is an artefact from the jsp:

Also Spring like, a controller and a validator class is used in this context, too.

The message bean is configured in this artifact:


It seems for me now at the moment I'm hadding against a regional specific language problem.
Who knows more and what are the possible work-arounds, in the JSP, the XML or/and Java source code.

Thanks
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to specify the numeric format conversion locale?
 
Folkert Meeuw
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Is there a way to specify the numeric format conversion locale?



Hello David!
I thought about your post. But, hm?

Instead, I took a look on this page at yesterday evening: http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html

And inbetween I worked around the problem in this way. While I did some unit tests on the method initBinder in the Controller class, I came to the PropertyEditor class. Inside the class of the PropertyEditor was my JointPoint. The method public void setAsText(String text) throws IllegalArgumentException. I wrote an Aspect via SpringAOP with the Advice String s = text.replace(',', '.');

An alternativ would be the refactoring of the application, here.

Kind regards
 
You didn't tell me he was so big. Unlike this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic