This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL expressions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL expressions " Watch "EL expressions " New topic
Author

EL expressions

mysha ahamed
Greenhorn

Joined: Aug 03, 2005
Posts: 22
Hi,
I am learning EL n have some basic dbts..

List list=new ArrayList();
list.add("list1");
list.add("list2");

Map tmap=new TreeMap();
tmap.put(new Integer(1) ,"map1");
tmap.put(new Integer(2),"map2");

request.setAttribute("li",list);
request.setAttribute("tma",tmap);

request.setAttribute("va",new Integer(1));

list : ${li[va]}<br> //line 1
map : ${tma[va]}<br> //line 2

My dbout is, in line 1 the attribute "va" shuld be evaluated to a primitive value (index of list) n in line 2 the same attribute "va" shuld be evaluated to an Integr object (treemaps expect comparable objects as keys)..So I dont understand how these attributes to object mappings (attribute "va"->Integer Object (1)) are evaluated in EL .
Can anyone pls clear my dbt..
Thnx..
Paolo Metafune
Ranch Hand

Joined: Aug 22, 2005
Posts: 34
The jsp 2.0 specification answer your question (see Part 1 Expression Language, .2.3.4 paragraph)

However, for mapping in line 1 the Integer reference "va" is coerced to int
and for mapping in line 2 the Integer reference "va" is normally used as map key to retrieve the value .

Bye
[ August 22, 2005: Message edited by: Paolo Metafune ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL expressions
 
Similar Threads
Integer and Integer object
Ch :8 QNo: 6 Pg:420
Error testing EL with bean
Doubt in HFSJ page-420
EL