Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

<f:converter> tags  RSS feed

 
Mee Kar Suu
Greenhorn
Posts: 11
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to convert class java.lang.Integer 10,005 of type to interface javax.faces.convert.Converter?
java.lang.String is ok and int type is not,I don't know why?
Please help me.Actually,I want to get comma format of integer.
thanks.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML is text and nothing but text. The JSF converters are simple pairs of methods designed to translate objects from their server-internal (binary) forms to text and back again.

Number formatting applies only to text representation of numbers. There is no such thing as a java.lang.Integer(10,005), because the digit separator (comma) isn't an attribute of Integers, it's a way of formatting the Integer for display purposes, and that process is not part of actual Integer itself, it's a transformation that uses an Integer as input.

Reading a number with digit separators and converting it to an Integer is going the other direction, and the opposite of "format" is "parse". The Java NumberFormat converters that come as part of the basic JVM package handle both formatting and parsing.
 
Mee Kar Suu
Greenhorn
Posts: 11
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Tim,

Thanks for your answer.
I already finished this problem yesterday.

Anyway thanks,
Mee
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!