EL表达式


EL表达式从哪里取值?一般情况下,从作用域对象中取值

${a}

EL表达式优先从哪个作用域对象中取值?默认情况下从最小作用域取值

${scope}

EL表达式从指定作用域对象中取值:pageScope、requestScope、sessionScope、applicationScope

${pageScope.scope} --- ${requestScope.scope} --- ${sessionScope.scope} --- ${applicationScope.scope}

EL表达式可以解析什么类型的数据?基本数据类型、对象类型、复合对象类型、Map、List

${list[2]} --- ${map.address} --- ${user.realname} --- ${user.addr.town}

EL也可以取请求参数的数据:param、paramValues

${param.name} --- ${paramValues.fav[2]}

EL表达式的[]内也可以做EL表达式的解析

${user.realname} --- ${user["realname"]} ---  ${user[param.type]}

EL表达式可以做为空判断:空字符串、null、空map、空list这几个值为true

${empty aaa} --- ${empty bbb} --- ${empty ccc} --- ${empty ddd} --- ${empty scope}

EL表达式可以做基本的逻辑运算,和数学运算

EL表达式没有字符串拼接的概念,也没有字符的概念

${5+4} --- ${5-4} --- ${5*4} --- ${5/4} --- ${5%4} --- ${5+"4"} ---

${5>4} --- ${5 < 4} --- ${5>=4} --- ${5 le 4} --- ${5 eq 4}

EL表达式中pageContext可以获取pageContext作用域对象本身

${pageContext}

你可能感兴趣的:(EL表达式)