aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL doubt" Watch "EL doubt" New topic
Author

EL doubt

vijay kumar
Ranch Hand

Joined: Nov 10, 2006
Posts: 62
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.
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Just add in your code <%@ page isELIgnored="false" %>
it will work.
vijay kumar
Ranch Hand

Joined: Nov 10, 2006
Posts: 62
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

Joined: Jun 23, 2007
Posts: 300

By the way whats there in EL_VARIABLES.jsp?
vijay kumar
Ranch Hand

Joined: Nov 10, 2006
Posts: 62
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
Jan van Mansum
Ranch Hand

Joined: Oct 19, 2007
Posts: 74
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.


SCJP 1.4, SCWCD 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL doubt