In the end the client (usually a browser) will receive a rendered version of your JSF Component tree, which you usually built via .xhtml files.
The browser doesn't know about BigDecimals
or Dates
for example. If you write "1.003" in an input field of a form, how should the browser know whether it will be a String
, or a float
or a BigDecimal
on server side? It cannot know that and also couldn't handle that. Thus the communication between server and browser is always via Strings
. When the HTML gets rendered, the getAsString()
method will be used. When processing the transmitted form inputs, JSF will use the getAsObject()
to convert it back to the real type.
Why does var
work in dataTables? Because here you will only go "one way". A dataTable will only display something and thus the generic toString()
method can be used. A conversion to the Object isn't necessary in this case.