File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes EL Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "EL" Watch "EL" New topic
Author

EL

geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
will this EL work

<%
List l= new ArrayList();
l.add("a");
request.setAttribute("list",l);
request.setAttribute("listIdx","1");
%>

${list['listIdx']}.
as per me.. the value in the [] must resolve to the index, but as it is quoted. it wont work.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56150
    
  13

What happened when you tried it? These are easy things to try out for yourself. Please let us know what you discover.
[ September 16, 2006: Message edited by: Bear Bibeault ]

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1002
as per me.. the value in the [] must resolve to the index, but as it is quoted. it wont work.


So remove the quotes:

geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
Stefan,

this was a question in one of the dumps, so i just cant remove the ''.

Bear, I tried it, there is a runtime exception when there are ''.Works ok when the '' are removed.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: EL
 
Similar Threads
EL Coercion question
EL expression question
using [] operator with an array
Head First Servlets and JSP Chapter 8 Mock exam
Doubt in HFSJ page-420