Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF converts null to blank

843842Sep 26 2006 — edited Sep 27 2006
Hello,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2006
Added on Sep 26 2006
2 comments
269 views