To permit the JSP page to access the data, the servlet needs to use setAttribute to store the data in one of the standard locations: the HttpServletRequest, the HttpSession, or the ServletContext. Objects in these locations are known as “scoped variables,” and the expression language has a quick and easy way to access them.

You can also have scoped variables stored in the PageContext object, but this is much less useful because the servlet and the JSP page do not share PageContext objects. So, page-scoped variables apply only to objects stored earlier in the same JSP page, not to objects stored by a servlet. To output a scoped variable, you simply use its name in an expression language element.

For example, ${name} means to search the PageContext, HttpServletRequest, HttpSession, and ServletContext (in that order) for an attribute named. If the attribute is found, its toString method is called and that result is returned. If nothing is found, an empty string (not null or an error message) is returned.

So, for example, the following two expressions are equivalent. ${name} <%= pageContext.findAttribute("name") %>

http://pdf.coreservlets.com/JSP-EL.pdf

© Prentice Hall and Sun Microsystems Press. Personal use only

最新文章

  1. tabhost 下 setOnItemClickListener失效的问题
  2. iOS之处理不等高TableViewCell的几种方法
  3. Android UI控件----ExpandableListView的基本用法
  4. 写JQuery 插件 什么?你还不会写JQuery 插件
  5. 设置跨域的iframe的高度
  6. oracle 语句 字段拼接(可换行)
  7. 多线程基础(五)NSThread线程通信
  8. 开源软件授权协议详解(GPL/MPL/LGPL/BSD/Apache Licence/Creative Commons/MIT)
  9. 【Android 错误记录】installation error: INSTALL_PARSE_FAILED_NO_CERTIFICATES 错误
  10. 单元测试React
  11. Cocos2d-Java安装和配置跨平台游戏引擎以及相关的开发工具
  12. dreamweaver代码提示失效
  13. iOS 极光推送的集成以及一些集成后的狗血
  14. SQL优化 MySQL版 - B树索引详讲
  15. PHP开发者的路书
  16. verilog实现毫秒计时器
  17. Pg188-2 覆盖 向上转型
  18. apache 与 iis共存
  19. 自定义规则,对List&lt;Map&lt;String,Object&gt;&gt; List&lt;Object&gt;进行排序
  20. [Python] dict字典的浅复制与深复制

热门文章

  1. 关于AFNetworking访问网络超时的设置
  2. 提升资源利用率的MapReduce框架
  3. [转]ORACLE 绑定变量用法总结
  4. [置顶] 读取pdf并且在web页面中显示
  5. S-DES加密
  6. Ubuntu GNOME 安装日语输入法(收集)
  7. java Spring 基于注解的配置(一)
  8. SQL 编译与重编译
  9. [linux] 系统管理常用命令
  10. NET异步调用Webserver