Reputation: 433
I have this code:
<input type="text" name="zipCode" maxlength="5" value="${zipCode!}">
When zipCode = null
(I use Java), the input field displayes null
. Why?
Thanks!
Upvotes: 0
Views: 168
Reputation: 806
In Freemarker doc:
If the default value is omitted, then it will be empty string
So, in your case Freemarker consider zipCode
with type String
, and this happens:
java.lang.String
public static String valueOf(Object obj) {
return (obj == null) ? "null" : obj.toString();
}
and you get null
as result.
If you want empty string instead null
just use !""
<input type="text" name="zipCode" maxlength="5" value="${zipCode!""}">
Upvotes: 0
Reputation: 433
@ddekany: you were rignt. zipCode has a String value that equals "null"
.
Upvotes: 1