• Post Reply Bookmark Topic Watch Topic
  • New Topic

El Expression problem  RSS feed

 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I am using Tomcat 5.0.28 and i am facing one problem regarding the el.

my code is like
<html>

<%!
String strname[]={"Chi","ran","saur","kir"};
request.setAttribute("attr1", strname);
%>

using ElCode the value is ${attr1["0"]}
</html>

The above line(EL Expression) is not functioning can anybody solve my problem. it gives the output as ${attr1["0"]}
but i want the output at the zeroth index.
please guide me.
[ January 03, 2006: Message edited by: Bear Bibeault ]
 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add the below line to ur jsp

<% page isELIgnored="false" %>
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply again Bala.
i really appreciate your effort. thanks once again.
Finally i got the expected output. jsut all depends on your effort thanks once again.

Could you tell me one thing is . Is it necessary to inclcude the <%@ page isELIgnored="false" %>.
without this we cant do .
Please let me.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chidanand Chauhan:

<%!
String strname[]={"Chi","ran","saur","kir"};
request.setAttribute("attr1", strname);
%>


You're trying to use the implicit object "request" from outside the service method. (using it from within a <%! tag).

This will work:



 
Balasubramani Dharmalingam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes Chauhan, u have to give isELIgnored=false in page directive , otherwise it will ignore all the EL expression used in the page.
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot for the information.
and Ben i did the scriplet rather then the declaration.
it works fine.

but thanks to Ben for guided me.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balasubramani Dharmalingam:
yes Chauhan, u have to give isELIgnored=false in page directive , otherwise it will ignore all the EL expression used in the page.


Incorrect. If the web app is properly declared as a servlet 2.4 web app in the deployment descriptor (which is should be if you are using JSP 2.0), no such on-page goo is necessary.
[ January 03, 2006: Message edited by: Bear Bibeault ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!