File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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~
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Get different scope attribute by using EL
 
Similar Threads
c:forEach code doubt
Error in c:set tag
c:out dont outputs anything???
can request and session attribute share the same name
JSP Struts/JSTL Form problem