当前位置:网站首页>El expression
El expression
2022-06-13 04:05:00 【Cavewang】
EL expression
What is? EL expression
EL expression (Expression Language), Originally defined in JSTL1.0 part , stay JSP2.0 in ,EL from JSTL Split it out , Put in JSP Specification , be called JSP2.0 canonical ⼀ part
stay JSP Chinese envoy ⽤EL expression , Access to objects and variables can be simplified EL expression
EL Expression syntax
Grammar format :
${ The name of the information to be displayed }
Be careful :
When the expression does not specify the range of variables or objects , Then the container will start from pageContext—>request—>session—>application Find the variable or object in , We can obtain the specified ⽤ Domain value :
pageScope object ,⽤ Get at present ⻚⾯ The attribute value
requestScope object ,⽤ To get the attribute value of the request range
sessionScope object ,⽤ To get the attribute value of the session scope
applicationScope object ,⽤ To get the property value of the program scope
grammar :
${requestScope.key}
EL Basic operators in
| The term | Definition |
|---|---|
| Arithmetic type | + 、-、 * /(div) except 、 %(mod) remainder |
| The logical model | and、&&、or、!、not、II |
| Relational type | ==、eq、!=、ne、、gt、<=、le、>=、ge. Can be compared with other values ⾏⽐ a , Or Boolean 、 String type 、 Integer or floating point ⽂ Words enter ⾏⽐ a . |
| Empty | Empty Operators are ⼀ A prefix operator ⽤ It's hard to judge ⼀ Whether the first value is null Or for empty Such as String str =“”; ${empty str} The return value is true; |
| Conditional type | A ?B :C. according to A The result of the assignment B or C. |
Example :
Single variable :${a+10}<br>
Single variable :${s}<br>
Single object :${key. Property name }
// object type
Users u=new Users();
u.setName("CaveWang");
u.setPass("abc");
pageContext.setAttribute("u1",u);
user.name=${u1.name}
user.pass=${u1.pass}
// A collection of objects
List list=new ArrayList();
list.add("CaveWang");
list.add(21);
list.add(u);
pageContext.setAttribute("list2",list);
list1=${list2[0]}<br/>
list2=${list2[1]}<br/>
list3=${list2[2].pass}<br/>
// Determine whether the variable has a value or exists :${empty key value }
List list2=new ArrayList();
list2.add("aa");
request.setAttribute("list222",list2);
// Judge list Is there any data in :${empty list222}
边栏推荐
- Line height equals height why not center
- ET框架-22 创建ServerInfo实体及事件
- [test development] use case
- R: Airline customer value analysis practice
- Principle and control program of single chip microcomputer serial port communication
- Manage PC startup items
- Lambda终结操作reduce归并
- Intervention analysis + pseudo regression
- Lambda end operation find and match findfirst
- V-bind and v-on
猜你喜欢

Goframe day 5

MCU: pcf8591 hardware interface

Intervention analysis + pseudo regression

高等数学(第七版)同济大学 习题1-3 个人解答

EIA map making - data processing + map making

单片机外设介绍:温度传感器 DS18B20

The most detailed swing transformer mask of window attachment in history -- Shaoshuai

How to use debounce in lodash to realize anti shake

5G China unicom AP:B SMS ASCII 转码要求

MCU: NEC protocol infrared remote controller
随机推荐
Advanced Mathematics (Seventh Edition) Tongji University exercises 1-2 personal solutions
Flex layout
Meaning of different values of margin and padding
Milliards de données pour déterminer si un élément existe
Lambda termination operation find and match nonematch
Stream流的注意事项
MSG messages in ROS
Lightweight digital mall system based on PHP
7-289 tag count (300 points)
USB-IF BC1.2充电协议解读
单片机/嵌入式的实时性疑问解答
Interpretation of usb-if bc1.2 charging protocol
Lambda termination operation Max & min
Lambda终结操作查找与匹配findFirst
Interpretation of mobile phone private charging protocol
5g China Unicom ap:b SMS ASCII transcoding requirements
[test development] automated test selenium (II) -- common APIs for webdriver
Use the visual studio code terminal to execute the command, and the prompt "because running scripts is prohibited on this system" will give an error
LVS四层负载均衡集群(3)集群功能分类 - HPC
SCM: introduction to Modbus communication protocol