EL表达式显示输出.doc

上传人:夏** 文档编号:550839824 上传时间:2023-07-10 格式:DOC 页数:7 大小:58.51KB
返回 下载 相关 举报
EL表达式显示输出.doc_第1页
第1页 / 共7页
EL表达式显示输出.doc_第2页
第2页 / 共7页
EL表达式显示输出.doc_第3页
第3页 / 共7页
EL表达式显示输出.doc_第4页
第4页 / 共7页
EL表达式显示输出.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《EL表达式显示输出.doc》由会员分享,可在线阅读,更多相关《EL表达式显示输出.doc(7页珍藏版)》请在金锄头文库上搜索。

1、1.普通字符串request.setAttribute(hello, hello world);-El表达式获取普通字符串hello(jsp脚本):hello(el表达式,el表达式的使用方法$和):$hello hello(el表达式,el的隐含对象pageScope,requestScope,sessionScope,applicationScope, 如果未指定scope,它的搜索顺序pageScopeapplicationScope):$requestScope.hello hello(el表达式,scope=session):$sessionScope.hello -页面输出.普通字

2、符串hello(jsp脚本):hello worldhello(el表达式,el表达式的使用方法$和):hello worldhello(el表达式,el的隐含对象pageScope,requestScope,sessionScope,applicationScope,如果未指定scope,它的搜索顺序为pageScopeapplicationScope):hello worldhello(el表达式,scope=session):2.结构Group group = new Group();group.setName(尚学堂);User user = new User(); user.setU

3、sername(张三); user.setAge(18); user.setGroup(group); request.setAttribute(user, user);-El表达式获取结构,采用.进行导航,也称存取器姓名:$user.username 年龄:$user.age 所属组:$user.group.name -页面输出.结构,采用.进行导航,也称存取器姓名:张三年龄:18所属组:尚学堂3.mapMap mapValue = new HashMap(); mapValue.put(key1, value1); mapValue.put(key2, value2);request.se

4、tAttribute(mapvalue, mapValue);-El表达式获取输出map,采用.进行导航,也称存取器mapvalue.key1:$mapvalue.key1 mapvalue.key2:$mapvalue.key2 -页面输出.输出map,采用.进行导航,也称存取器mapvalue.key1:value1mapvalue.key2:value24.字符串数组String strArray = new Stringa, b, c;request.setAttribute(strarray, strArray);User users = new User10; for (int i

5、=0; i10; i+) User u = new User(); u.setUsername(U_ + i); usersi = u; request.setAttribute(users, users);-El表达式获取输出对象数组,采用和下标userarray3.username:$users2.username -页面输出.输出对象数组,采用和下标userarray3.username:U_25.ArrayListList userList = new ArrayList(); for (int i=0; i10; i+) User uu = new User(); uu.setUse

6、rname(UU_ + i); userList.add(uu); request.setAttribute(userlist, userList);-El表达式获取输出list,采用和下标userlist5.username:$userlist4.username -页面输出输出list,采用和下标userlist5.username:UU_46.emptyrequest.setAttribute(value1, null);request.setAttribute(value2, );request.setAttribute(value3, new ArrayList();request.

7、setAttribute(value4, 123456);-El表达式获取el表达式对运算符的支持 1+2=$1+2 10/5=$10/5 10 div 5=$10 div 5 10%3=$10 % 3 10 mod 3=$10 mod 3 !- =/eq !=/ne /gt=/ge&/and|/or!/not/div%/mod- 测试empty value1:$empty value1 value2:$empty value2 value3:$empty value3 value4:$empty value4 value4:$!empty value4 -页面输出.el表达式对运算符的支持1

8、+2=310/5=2.010 div 5=2.010%3=110 mod 3=1.测试emptyvalue1:truevalue2:truevalue3:truevalue4:falsevalue4:true普通字符串request.setAttribute(hello, hello world);-El表达式获取普通字符串hello(jsp脚本):hello(el表达式,el表达式的使用方法$和):$hello hello(el表达式,el的隐含对象pageScope,requestScope,sessionScope,applicationScope, 如果未指定scope,它的搜索顺序p

9、ageScopeapplicationScope):$requestScope.hello hello(el表达式,scope=session):$sessionScope.hello -页面输出.普通字符串hello(jsp脚本):hello worldhello(el表达式,el表达式的使用方法$和):hello worldhello(el表达式,el的隐含对象pageScope,requestScope,sessionScope,applicationScope,如果未指定scope,它的搜索顺序为pageScopeapplicationScope):hello worldhello(e

10、l表达式,scope=session):2.结构Group group = new Group();group.setName(尚学堂);User user = new User(); user.setUsername(张三); user.setAge(18); user.setGroup(group); request.setAttribute(user, user);-El表达式获取结构,采用.进行导航,也称存取器姓名:$user.username 年龄:$user.age 所属组:$user.group.name -页面输出.结构,采用.进行导航,也称存取器姓名:张三年龄:18所属组:尚学堂3.mapMap mapValue = new HashMap(); mapValue.put(key1, value1); mapValue.put(key2, value2);request.setAttribute

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号