1<% 2String str1=null; 3String str2=""; 4String str3="aa"; 5ArrayList al1=null; 6ArrayList al2=new ArrayList(); 7ArrayList al3=new ArrayList(); 8al3.add("aa"); 9 10request.setAttribute("str1", str1); 11request.setAttribute("str2", str2); 12request.setAttribute("str3", str3); 13request.setAttribute("al1", al1); 14request.setAttribute("al2", al2); 15request.setAttribute("al3", al3); 16%> 17 18 19 <c:if test="${empty str1 }"> 20 str1 21</c:if> 22<c:if test="${empty str2 }"> 23 str2 24</c:if> 25<c:if test="${empty str3 }"> 26 str3 27</c:if> 28<c:if test="${empty al1 }"> 29 al1 30</c:if> 31<c:if test="${empty al2 }"> 32 al2 33</c:if> 34<c:if test="${empty al3 }"> 35 al3 36</c:if>
测试结果是:str1 str2 al1 al2
说明: