File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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.
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
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

Servlet 2.3 > JSP 1.2
Servlet 2.4 > JSP 2.0


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

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
The EL expression for x = ${x}. is trying to access a scripting variable. EL cannot access scrpting variables.
 
wood burning stoves
 
subject: EL doubt