|
A primary feature of JSP technology version 2.0 is its support for an expression language (EL). An expression language makes it possible to easily access application data stored in JavaBeans components. As the EL is introduced in JSP 2.0, we can also use the page attribute isELIgnored to ignore the EL for a page.
<%@ page isELIgnored ="true|false" %>
The following is the EL operator table which can be used with the EL language.
Note:- and,eq,gt,true,instanceof,or,ne,le,false,empty, not,lt,ge,null,div and mod are reserved words in the EL so user cannot use these words for the identifiers.
Expression | Result |
|---|
\${3+2-1}
|
${3+2-1} <%-- Addition/Subtraction --%> |
\${"1"+2}
|
${"1"+2} <%-- String conversion --%> |
\${1 + 2*3 + 3/4}
|
${1 + 2*3 + 3/4} <%-- Mult/Div --%> |
\${3%2}
|
${3%2} <%-- Modulo --%> |
\${(8 div 2) mod 3}
|
${(8 div 2) mod 3} <%-- Compares with "equals" but returns false for null --%> |
\${1<2}
|
${1<2} <%-- Numerical comparison --%> |
\${"a"<"b"}
|
${"a"<"b"} <%-- Lexical comparison --%> |
\${2/3 >= 3/2}
|
${2/3 >= 3/2} <%-- >= --%> |
\${3/4 == 0.75}
|
${3/4 == 0.75} <%-- Numeric = --%> |
\${null == "test"}
|
${null == "test"} |
\${(1<2) && (4<3)}
|
${(1<2) && (4<3)} <%--AND--%> |
\${(1<2) || (4<3)}
|
${(1<2) || (4<3)} <%--OR--%> |
\${!(1<2)}
|
${!(1<2)} <%-- NOT -%> <%-- Handles null or empty string in request param --%> |
\${empty ""}
|
${empty ""} <%-- Empty string --%> |
\${empty null}
|
${empty null} <%-- null --%> |
|