Given the following view-state and binding:
<view-state id="updatePartner" view="/partners/partnerForm" model="partner">
<binder>
<binding property="name" required="true" />
<binding property="address" required="true" />
<binding property="address2" />
<binding property="city" required="true" />
<binding property="state" required="true" />
<binding property="zip" required="true" />
<binding property="phone" required="true" />
</binder>
...
</view-state>
I'm getting a Partner object with "" in address2. I want a null there.
How do I force a null instead of blank strings? I would like to avoid explicit POJO setters that coerce blank strings into nulls
.
I looked at Converters, but those seem to convert from one type to another (i.e. String to Long, etc.) and I think it would create to extra work for the application if I created a Converter to convert all Strings to Strings and made it remove blank strings, and in addition, that could theoretically break other things that I don't want touched.
I've seen the StringTrimmerEditor option (https://stackoverflow.com/a/2977863/3810920), and I can see the InitBinder method getting called, but my POJO still has "" in address2.
Thanks!