Re: newbie guestion: JSTL Expression language

2006-03-16 Thread vijay venkataraman

The text as is from JSP 2.0 Spec

Point 1.
EL expression An element in a JSP page representing an expression to be 
parsed

and evaluated via the JSP Expression Language. Syntactically it is delimited
by the ${ and } characters.

Point 2.
JSP.2.3.5.5 Relational Operators
The relational operators are:
== and eq
!= and ne
< and lt
> and gt
<= and le
>= and ge

Point 3
JSP.2.3.5.7 A {==,!=,eq,ne} B
If A==B, apply operator
If A is null or B is null return false for == or eq, true for != or ne.
If A or B is BigDecimal, coerce both A and B to BigDecimal and then:
If operator is == or eq, return A.equals( B )
If  operator is != or ne, return !A.equals( B )
If A or B is Float or Double coerce both A and B to Double, apply operator
...

Your code


  The role is editor



  The role is editor


So from point 1 and point 2

  (See the expression is with in ${} point 1)
  The role is editor

will work . See Point 2 bulleted points  . == and eq and Point 3 how the 
relational operator is evaluated. You can look for more information in 
the spec.


So

  The role is editor

is same as

  The role is editor


Thanks,
Vijay Venkataraman

Rahul Akolkar wrote:


On 3/16/06, Morten Andersen <[EMAIL PROTECTED]> wrote:
 


I want to use JSTL to check the role of the user (it can be one of many)

I'm new to JSTL so even the simplest things gives me problems:

I've set the role using request.setAttribute("role" , role);

This tag:


Prints out the role fine

While the following statements are newer true:


   




Expression must be contained in ${ and } in its entirety i.e.

${role eq 'editor'}


 


  The role is editor



   




${role ne 'editor'}

-Rahul


 


  The role is editor


Where do I go wrong?

Morten


   



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 




--DISCLAIMER--
This message is for the named person's use only. It may contain 
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. 

If you receive this message in error, please immediately delete it and 
all copies of it from your system, destroy any hard copies of it and 
notify the sender. You must not, directly or indirectly, use, disclose, 
distribute, print, or copy any part of this message if you are not the 
intended recipient. 

Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each 
reserve the right to monitor all e-mail communications through its 
networks. 

Any views expressed in this message are those of the 
individual sender, except where the message states otherwise and the 
sender is authorized to state them to be the views of any such entity.


Re: newbie guestion: JSTL Expression language

2006-03-16 Thread Rahul Akolkar
On 3/16/06, Morten Andersen <[EMAIL PROTECTED]> wrote:
> I want to use JSTL to check the role of the user (it can be one of many)
>
> I'm new to JSTL so even the simplest things gives me problems:
>
> I've set the role using request.setAttribute("role" , role);
>
> This tag:
> 
>
> Prints out the role fine
>
> While the following statements are newer true:
>
>  


Expression must be contained in ${ and } in its entirety i.e.

${role eq 'editor'}


>The role is editor
>  
>
>  


${role ne 'editor'}

-Rahul


>The role is editor
>  
>
> Where do I go wrong?
>
> Morten
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: newbie guestion: JSTL Expression language

2006-03-16 Thread Wojciech Ciesielski



Morten Andersen wrote:

I want to use JSTL to check the role of the user (it can be one of many)

I'm new to JSTL so even the simplest things gives me problems:

I've set the role using request.setAttribute("role" , role);

This tag:


Prints out the role fine

While the following statements are newer true:

 
   The role is editor
 

 
   The role is editor
 

Where do I go wrong?


test is wrong :-) It should be

test="${role eq 'editor'}

if you want to compare with strings or

test="${role eq editor}

if you have variable "editor" in page/request/session scope with value 
you want to check against


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



newbie guestion: JSTL Expression language

2006-03-16 Thread Morten Andersen

I want to use JSTL to check the role of the user (it can be one of many)

I'm new to JSTL so even the simplest things gives me problems:

I've set the role using request.setAttribute("role" , role);

This tag:


Prints out the role fine

While the following statements are newer true:

 
   The role is editor
 

 
   The role is editor
 

Where do I go wrong?

Morten



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]