这有效:
String address1 = HtmlUtil.escape(rs.getString("address1"));
...但是我不想显示“空”。所以我试了一下,这是行不通的:
String address1 = HtmlUtil.escape(rs.getString("address1") || "");
是使用此的最佳选择吗?
String address1 = HtmlUtil.escape(rs.getString("address1"));
if (address1 == null) address1 = "";
最佳答案
String address1 = HtmlUtil.escape(rs.getString("address1"));
if (address1 == null || address1.equals("null")) {
address1 = "";
}