Learn Java for Web Development

(Tina Meador) #1

110 CHAPTER 3: Best Practices in Java EE Web Development


Literals

An EL literal can be the following types: Boolean, integer, floating-point, string, or null. Table 3-1
shows the valid values for each literal type.


Table 3-1. Literals in EL


Literal Type Valid Literal Value

Boolean true or false
Integer -11
0
12345
Floating point 4.21
-8.01
1.0E12
0.12
String Both valid: "hello" and 'hello'
Null null

Table 3-2. Reserved Words in EL


and eq gt true
instanceof or ne le
false empty not lt
ge null div mod

Reserved Words

As with any other language, EL has words that are reserved and should not be used as identifiers.
Table 3-2 lists the reserved words in EL.


EL Operators

The EL operations are necessary to handle data manipulations. EL supports several operators such
as relational, arithmetic, logical, and others.


Arithmetic Operators


Listing 3-6 illustrates some of these operators. You can use this code on a JSP file and run it on the
server. Figure 3-2 illustrates the output.

Free download pdf