Given a scenario, write EL code that uses the following operators: aritmetic operators, relational operators, and logical operators.

There are the arithmetic operators here: '+', '-', '*', '/', '%'. You can also use the following for the '/' (division) and '%' (remainder or modulo) operators: div and mod. You can see examples of these being used below:


6 + 7 = ${6+7}<br>
8 x 9 = ${8*9}<br>

					

The relational operators are shown below:

Table 7.2. The relational operators

Symbol versionText Version
==eq
!=ne
<lt
>gt
>=ge
<=le

Here are some basic comparisons:


Is 1 less than 2? ${1<2} <br>
Does 5 equal 5? ${5==5} <br>
Is 6 greater than 7? ${6 gt 7}<br>

					

The logical operators are the same as the Java Programming Language, but they also have their textual equivalents within the EL.

Table 7.3. The logical operators

Symbol versionText Version
&&and
||or
!not

The empty operator allows you to test the following:

You use the operator in the following way:


empty variableName

					
If any of the above conditions are met, then the operator returns true.

Professional hosting     Belorussian informational portal         Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide