Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

EL doubt  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!