<%--1.el可以进行自动的类型转化 --%>
score:${param.score +11}<br/>
score:<%=request.getParameter("score")+11 %><br/>
/*
url地址栏http://localhost:8080/ELx/el2.jsp?score=23
输出结果
score:34
score:2311
*/
<%--2.EL的[]和.运算符 --%>
age:${sessionScope.uu["uid"]}<br/>
<%--
上面的啥时用[]比如下面的
如果遇对象的属性名带有".",则用[]会很方便
--%>
<%
UserBean uux = new UserBean();
uux.setUid(89);
session.setAttribute("cn.itcast.bean",uux);
%>
age:${sessionScope["cn.itcast.bean"].uid};
<!-- 3.隐含对象是pageScope,requestScope,sessionScope,applicationScope-->
time:${time }<br/>
/*
${username}。它的意思是取出某一范围中名称为 username
的变量。因为我们并没有指定哪一个范围的 username,所以它的默认值会先从 Page 范围找,假如
找不到,再依序到 Request、Session、Application 范围。假如途中找到 username,就直接回传,
不再继续找下去,但是假如全部的范围都没有找到时,就回传 null
*/
<!-- 4.param与paramValues -->
score:${param.score }<br/>
a:${paramValues.a[0] }<br/>
/*
${param.属性名}:获取一个请求参数
${paramValues.属性名}:获取一组请求参数(一般用于checkbox)
*/
<!-- 5.其他隐含对象 Cookie -->
JSESSIONID:${cookie.JSESSIONID.name }<br/>
JSESSIONID:${cookie.JSESSIONID}<br/>
headers:${header["Accept-Language"] }<br/>
<!-- pageContext等() -->
initParam:${initParam.df }<br/>
contextPath:${pageContext.request.contextPath }<br/>
localPort:${pageContext.request.localPort }<br/>
servletPath:${pageContext.request.servletPath }<br/>
servletContext:${pageContext.request.servletContext }<br/>
<!--
输出结果
initParam:sdfg
contextPath:/ELx
localPort:8080
servletPath:/el3.jsp
servletContext:org.apache.catalina.core.ApplicationContextFacade@18600ed
-->
<!-- 6.empty可以作用于一个集合 若该集合不存在或几何中没有元素 其结果都为true -->
<%
List<String> list = new ArrayList<String>();
list.add("asdf");
List<String> list1 = new ArrayList<String>();
request.setAttribute("name", list);
request.setAttribute("name1", list1);
%>
the empty:${empty name }<br/>
the empty:${empty name1 }<br/>
the empty:${empty name2 }
<!--
输出结果
the empty:false
the empty:true
the empty:true
-->