<html><body> <b>Expression Language Variables</b> <%! int x=4; %> <p>The script expression for x = <%= x %>. <p>The EL expression for x = ${x}. <form action="EL_Variables.jsp" method="GET"> <p>What is x? <input type="text" size=2 name="num"> <p><input type="submit"> </form> <p>That's ${param.num == 4}! </body></html>
and i am expecting output in this way
Expression Language Variables The script expression for x = 4.
The EL expression for x =
What is x?
That's true
if i pass x=4
but i am getting output as
Expression Language Variables The script expression for x = 4.
The EL expression for x = ${x}.
What is x?
That's ${param.num == 4}!
Please help me .... Thanks in advance.... Regards, Vijay.
Remko Strating
Ranch Hand
Joined: Dec 28, 2006
Posts: 893
posted
0
I think EL is not enabled.
Check which kind of JSP you're using. You need to use JSP 2.0 or higher for EL. You can check this in the web.xml
Even i tried the same program and i got the result as .........
Expression Language Variables The script expression for x = 4.
The EL expression for x =.
What is x?
That's true!
its evaluating the ${param.x==4} part,where i am passing the value in the text field and param.num is resolving to that value i entered but its not printing the value of x (at second line) declared .Does EL have any restrictions of such kind?
Sandeep Krish
Ranch Hand
Joined: Jan 02, 2007
Posts: 58
posted
0
The EL expression for x = ${x}. is trying to access a scripting variable. EL cannot access scrpting variables.