• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

EL doubt

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i have a problem with EL.i tried this program

<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.
 
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just add in your code <%@ page isELIgnored="false" %>
it will work.
 
vijay kumar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have used ,i am getting an error

Parsing of JSP File '/EL_Variables.jsp' failed:
--------------------------------------------------------------------------------
/EL_Variables.jsp(2): unrecognized JSP directive: 'isELIgnored'='false'
probably occurred due to an error in /EL_Variables.jsp line 2:
<%@ page isELIgnored="false" %>

in web xml also i added the
<el-enabled>true</el-enabled>

tag but its not reflecting
 
carina caoor
Ranch Hand
Posts: 300
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way whats there in EL_VARIABLES.jsp?
 
vijay kumar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is simple jsp

code:
<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>

still i am not able to enable the EL's
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is very strange that your EL expressions are treated as template text only after you submit your form. I would expect them to be treated as such always or never, but not "sometimes".

Anyway, I can see what you are trying to do and it will not work. You have declared a field in your JSP-page (or the servlet that is generated from your JSP page) and you want to retrieve its value in an EL expression. EL however requires variables that are attributes of one of the four scopes: page, request, session or context.

Also, it is usually not a good idea to use servlet instance variables, as they can be accessed and changed by multiple clients.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic