ESX常见的文件类型
2013-02-26 15:32
134 查看
The primary feature of JSP 2.0 is its support for an expression language(EL). An expression language makes it possible to easily access application data stored in javabeans components.
Active and Deactive EL:
<%@page isELIgnored=”false | true”%>
EL可以被用在哪里?
l 静态文本
${“static text……”}
l In any standard or custom tag attribute that can accept an expression
<some:tag value=”abc ${a1} ${a2}” />
用 . 和 [] 访问对象的属性
${user.id} 与 ${user[‘id’]} 效果是一样的,都是调用getId()方法。这里注意,访问的是属性property而非字段field,所以,user并不一定要有名为id的字段,但一定要有名为getId()的方法用以供调用。
如果user是一个javabean,那么用.和[]就是去调用其property的访问方法。
如果user是一个List, 那么id就会被强制转成int,然后实行user.get(id),从而返回了List中的元素。若产生IndexOutOfBoundsException,将返回null,若是别的异常,将被抛出。
如果user是一个Map,那么id被当作key,然后执行user.get(id),返回key所对应的值。若 user.containsKey(id)为false,则返回null.
EL除了可以从不同的访问范围内拿我们设定的对象,还可以访问隐性对象 Implicit Object. 隐性对象是指,由web container在application加载的时候而设定的。JSP定义了一些列Implicit Object,如:
-
等等。我们可以使用EL来直接访问,${pageContext.request.localName}
${pageContext.session.creationTime}
Active and Deactive EL:
<%@page isELIgnored=”false | true”%>
EL可以被用在哪里?
l 静态文本
${“static text……”}
l In any standard or custom tag attribute that can accept an expression
<some:tag value=”abc ${a1} ${a2}” />
用 . 和 [] 访问对象的属性
${user.id} 与 ${user[‘id’]} 效果是一样的,都是调用getId()方法。这里注意,访问的是属性property而非字段field,所以,user并不一定要有名为id的字段,但一定要有名为getId()的方法用以供调用。
如果user是一个javabean,那么用.和[]就是去调用其property的访问方法。
如果user是一个List, 那么id就会被强制转成int,然后实行user.get(id),从而返回了List中的元素。若产生IndexOutOfBoundsException,将返回null,若是别的异常,将被抛出。
如果user是一个Map,那么id被当作key,然后执行user.get(id),返回key所对应的值。若 user.containsKey(id)为false,则返回null.
EL除了可以从不同的访问范围内拿我们设定的对象,还可以访问隐性对象 Implicit Object. 隐性对象是指,由web container在application加载的时候而设定的。JSP定义了一些列Implicit Object,如:
pageContext
-servletContext
-session
-request
-
response
等等。我们可以使用EL来直接访问,${pageContext.request.localName}
${pageContext.session.creationTime}
Table 12-2 Example Expressions | |
EL Expression | Result |
${1 > (4/2)} | false |
${4.0 >= 3} | true |
${100.0 == 100} | true |
${(10*10) ne 100} | false |
${'a' < 'b'} | true |
${'hip' gt 'hit'} | false |
${4 > 3} | true |
${1.2E4 + 1.4} | 12001.4 |
${3 div 4} | 0.75 |
${10 mod 4} | 2 |
${empty param.Add} | True if the request parameter named Add is null or an empty string |
${pageContext.request.contextPath} | The context path |
${sessionScope.cart.numberOfItems} | The value of the numberOfItems property of the session-scoped attribute named cart |
${param['mycom.productId']} | The value of the request parameter named mycom.productId |
${header["host"]} | The host |
${departments[deptName]} | The value of the entry named deptName in the departments map |
${requestScope['javax.servlet. forward.servlet_path']} | The value of the request-scoped attribute named javax.servlet. forward.servlet_path |
相关文章推荐
- Linux 常见环境变量、文件类型、权限管理
- php中利用header设置content-type和常见文件类型的content-type
- 生成Hibernate映射文件时 常见字段类型转换
- 常见文件类型识别
- Windows平台上安装LaTeX工具以及LaTeX常见的文件类型汇总
- IDEA使用教程:3、常见文件类型的图标介绍
- php上传常见文件类型对应的$_FILES["file"]["type"]。
- ASP.NET中常见文件类型、扩展名、存放位置及用途总结
- linux常见文件类型
- 常见文件类型
- 常见文件类型处理: 属性文件/CSV/EXCEL/HTML/压缩文件
- linux Tar命令的用法与常见压缩文件类型及解压
- php中常见的文件类型
- Linux中常见文件类型及文件系统类型
- php上传常见文件类型和$_FILES["file"]["type"]
- 游戏开发中iis常见支持MIME类型文件解析
- IDEA 常见文件类型的图标介绍
- 常见文件http中content-type头值(MIME类型)
- 游戏开发中IIS常见支持MIME类型文件解析
- Linux常见的操作(一) ->常见文件类型, 新建和删除文件或文件夹