日期:2014-05-16  浏览次数:20436 次

页面jstl判断字符串为空时报错

引用:http://www.85java.com/thread-2863-1-1.html

?

?

?

在jsp页面用到jstl的if或when标签判断字符串是否为空的时候,有时候经常这样判断:

Java代码
<c:when test="${allowedUploadImageExtension != ""}">??
<c:if test="${allowedUploadImageExtension != ""}">?

<c:when test="${allowedUploadImageExtension != ""}">
<c:if test="${allowedUploadImageExtension != ""}">
这样判断会报错,提示有未结束的标签,正确的书写格式是这样的:

Java代码
<c:when test="${not empty allowedUploadImageExtension}">??
或者??
<c:when test="${allowedUploadImageExtension != ''}"?

<c:when test="${not empty allowedUploadImageExtension}">
或者
<c:when test="${allowedUploadImageExtension != ''}"