• 关于EL表达式随笔记录


    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <%@ page import="java.util.*"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
        <%
            List<String> list1 = null;
            List<String> list2 = new ArrayList<String>();
            list2.add("aaaaa");
            List<String> list3 = new ArrayList<String>();
            // int a; // 当没有给数组变量赋值的时候会报错(本地变量没有被初始化)
            int[] a = null;
            int[] b = new int[3];
            int[] c = {};
            request.setAttribute("list1", list1);
            request.setAttribute("list2", list2);
            request.setAttribute("list3", list3);
            request.setAttribute("array1", a);
            request.setAttribute("array2", b);
            request.setAttribute("array3", c);
        %>
        
        list1: ${empty list1 }<br> <!-- true -->
        list2: ${empty list2 }<br> <!-- false -->
        list3: ${empty list3 }<br> <!-- 返回true, 只new一个集合对象不调用add方法对EL表达式来说此集合是空的 -->
        array1: ${empty array1 }<br> <!-- true -->
        array2: ${empty array2 }<br> <!-- false -->
        array3: ${empty array3 }<br> <!-- 返回false, 声明一个空数组对象对EL表达式来说是有值的 -->
    </body>
    </html>
  • 相关阅读:
    mysql查看进程
    mysql case, if
    centos升级python2.7
    centos多版本python安装pip
    Python library not found: libpython2.7mu.so.1.0
    pip cannot confirm SSL certificate: SSL module is not available
    python: no module named bz2
    summary
    python生成可执行文件保护源码
    mysql 存储过程
  • 原文地址:https://www.cnblogs.com/wgbs25673578/p/8438636.html
Copyright © 2020-2023  润新知