• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Get different scope attribute by using EL

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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~~
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jack Lam
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oic....thank a lot~
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic