File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Using variable in expression language 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 "Using variable in expression language" Watch "Using variable in expression language" New topic

Using variable in expression language

Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
Does anyone know if we can use variables defined in a scriptlet in a an expression language ?

For example, I defined the variable var as following:

<%! String var = "a variable"; %>

Then i try to test if this variable is equal to "a variable"

${var eq "a variable"}

this returns false, i guess the evalaution of the variable var returns null because EL are only looking for variables in any scopes but I am not sure ! That is why I am asking you this simple question.

If there is a special way to access those variable, let me know.

Thanks you in advance
Sivasundaram Umapathy
Ranch Hand

Joined: Aug 10, 2002
Posts: 360
Only implicit variables and variables defined in one of page,request,session or application scopes are available to EL.

So there is no special way to access these varuables unless you add them to some scope.

Co-Author - SCMAD Exam Guide - ISBN:9780070077881
Author - Java certification success, Part 4: SCEA
Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
Thanks a lot for your response, that helps me a lot in my preparation of the certification SCWCD 1.4
I agree. Here's the link:
subject: Using variable in expression language
It's not a secret anymore!