File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get different scope attribute by using EL

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