This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Get different scope attribute by using EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Get different scope attribute by using EL" Watch "Get different scope attribute by using EL" New topic
Author

Get different scope attribute by using EL

Jack Lam
Greenhorn

Joined: Jul 09, 2004
Posts: 17
Hello,

i would like to use EL to get the variable in different scope,
i know that EL will find the variable in all scope (page, request, session, application)
so now i am trying to test the mechanism by writing code to test...
<%
SortedMap m = new TreeMap();
SortedMap n = new TreeMap();
m.put("Sneezy", "common cold");
n.put("Sneezy", "good");
pageContext.setAttribute("map", m);//page scope variable
session.setAttribute("map", n); //session scope variable
%>
<c ut value='${map.Sneezy}'>
empty !!!
</c ut>
i found that it print out "common cold",
so i would like to ask.... do Servlet container have a sequence to search the variable all scope? all how can i determine which one it will display?


thanks~~


SCJP 1.4 , SCWCD (in progress)
Somnath Jamdar
Greenhorn

Joined: May 28, 2004
Posts: 22
Hi

The order of searching for the scope is
page, request, session or application

for more info refer to the PDF at
http://www.ii.uib.no/~khalid/atij/atij-more-jsp-web/atij-more-jsp-II-2x1.pdf


Somnath Jamdar<br />SCJP, SCWCD
Jack Lam
Greenhorn

Joined: Jul 09, 2004
Posts: 17
oic....thank a lot~
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Get different scope attribute by using EL