Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EL  RSS feed

 
geeta lalchandani
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65828
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!