我使用net.sf.json作为JSONObject。json对象中的null值不等于Java null。使用<c:if test='${not empty obj.value}'>
不起作用。有什么方法可以比较JSTL标记中的JSON空值。
如下进行:
<c:if test='${JSONObject.NULL eq obj.value}'>
您将需要导入net.sf.json.JSONObject
到JSP中。
[更新]
如果上述方法不起作用,请尝试以下方法:
<c:if test='${obj.value.class.simpleName eq "JSONNull"}'>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句