File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Number formatting in text input Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Number formatting in text input" Watch "Number formatting in text input" New topic
Author

Number formatting in text input

Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
I need to show numbers in an input text field on a form to 5 points of precision eg 0.25 must be shown as 0.25000
That's easy, but submitting them again and converting them to floats doesn't work, I get conversion errors. I thought I could get around the problem by having a get method that returns a string, and a set method that takes a float, eg.



But this doesn't work. I get 'Conversion Error "newPrice": Error during model data update.' Can anyone help me?
Bagwan Mehrat
Ranch Hand

Joined: Jan 26, 2002
Posts: 119
I wonder if f:convertNumber would do what you want. If not, then you can write a custom converter, a class that implements javax.faces.convert.Convert.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Number formatting in text input
 
Similar Threads
Can't get c:import to work
confused in converter
Error in request.getParameter
User input either from drop down list or input text filed
float conversion error with f:convertNumber