JSF converts null to blank
843842Sep 26 2006 — edited Sep 27 2006Hello,
I have this code in a JSF page:
<h:inputText id="someField" value="#{myController.myBean.someField}" ...
If someField is null, because it has not been set, I'd expect the HTML input field to be empty. However, it is a blank. This is very annoying, because in my app that value is illegal and does not validate. Thus the user clicks to edit myBean and has to delete the spaces from all the null fields, before he can save, otherwise the app won't accept his input.
What can I do here? I tried to write a converter for that, which basically returns "" (empty string) when the String object is null, but that didn't change the behavior in any way.
Ulrich