Accessing Scoped Variables

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

时间: 2024-08-05 03:54:59

Accessing Scoped Variables的相关文章

Accessing Lua global variables from c++

http://blog.csdn.net/cnjet/article/details/5909541 Calling Lua scripts from c++’s example was written in post How to embed Lua 5.1 in C++. Now, let us look at how to access Lua’s global variables from c++. Value passing between c++ and Lua rely on Lu

javascript中null和undefined的区别到底是什么?

8年前我开始学习js的时候,对我来说比较诡异的一个事情是undefined和null都代表空值.那么他们之间明确的不同点是什么呢?他们都能去定义空值,而且null == undefined的值也是TRUE. 大部分现代语言像Ruby,Python,或者Java都只有一个空值nil 或者null,  这是很明智的方法. 而js中,如果一个变量或者一个对象没有进行初始化,(编译器)就会返回一个undefined. 例如: let company; company; // => undefined l

jsp 是什么 ,jsp 隐式对象

google 搜索 java server page http://www.oracle.com/technetwork/java/javaee/jsp/index.html http://docs.oracle.com/javaee/5/tutorial/doc/bnagx.html 5.  JavaServer Pages Technology 6.  JavaServer Pages Documents 7.  JavaServer Pages Standard Tag Library 8

c++builder 泛型

http://docwiki.embarcadero.com/RADStudio/XE6/en/How_to_Handle_Delphi_Generics_in_C%2B%2B 这个泛型是为delphi编写的,c++builder不能直接使用,非要用的话按下面的例子,先建立个delphiunit,集成新类,然后再c++builder引用此单元头文件,就可以了.真麻烦. How to Handle Delphi Generics in C++ Go Up to Handling Delphi Fe

Something About Perl

Perl is a high-level , general-purpose,interpreted ,dynamic programming language . It was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier . It borrows features from other progra

SUSE下搭建NTP时间同步服务器

linux:~ # cat /etc/ntp.conf | grep -v "^#" server 127.127.1.0          # local clock (LCL)fudge  127.127.1.0 stratum 10     # LCL is unsynchronized restrict default nomodify server 127.127.1.0 server 127.127.1.0 prefer driftfile /var/lib/ntp/dri

Objective-C 内存管理之dealloc方法中变量释放处理

本文转载至 http://blog.sina.com.cn/s/blog_a843a8850101ds8j.html (一).关于nil http://cocoadevcentral.com/d/learn_objectivec/ Calling Methods on Nil In Objective-C, the nil object is the functional equivalent to the NULLpointer in many other languages. The dif

Vmware Workstation + Suse Linux 11 SP3 + db2 purescale V10.5 (四)

本文详细记录了DB2 purescale 10.5在VMware Workstation 上的安装过程,如果大家看了本人的博文后,实践过程中有什么问题,欢迎加本人微信84077708,我将尽我所能为大家解惑. VMware Tools 安装好了以后,就可以实现物理机与虚拟机之间自由交换数据了,下面开始配置Suse linux 11SP3 操作系统: 1.配置/etc/hosts 2.配置DNS主备服务器 3.修改内核参数 4.修改资源限制 5.配置NTP服务器 一.配置/etc/hosts (n

Java Programming Tutorial Java Native Interface (JNI)

1.  Introduction At times, it is necessary to use native codes (C/C++) to overcome the memory management and performance constraints in Java. Java supports native codes via the Java Native Interface (JNI). JNI is difficult, as it involves two languag