1 | <!-- |
---|
2 | Licensed to the Apache Software Foundation (ASF) under one or more |
---|
3 | contributor license agreements. See the NOTICE file distributed with |
---|
4 | this work for additional information regarding copyright ownership. |
---|
5 | The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
6 | (the "License"); you may not use this file except in compliance with |
---|
7 | the License. You may obtain a copy of the License at |
---|
8 | |
---|
9 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | |
---|
11 | Unless required by applicable law or agreed to in writing, software |
---|
12 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | See the License for the specific language governing permissions and |
---|
15 | limitations under the License. |
---|
16 | --> |
---|
17 | <html> |
---|
18 | <head> |
---|
19 | <title>JSP 2.0 Expression Language - Basic Comparisons</title> |
---|
20 | </head> |
---|
21 | <body> |
---|
22 | <h1>JSP 2.0 Expression Language - Basic Comparisons</h1> |
---|
23 | <hr> |
---|
24 | This example illustrates basic Expression Language comparisons. |
---|
25 | The following comparison operators are supported: |
---|
26 | <ul> |
---|
27 | <li>Less-than (< or lt)</li> |
---|
28 | <li>Greater-than (> or gt)</li> |
---|
29 | <li>Less-than-or-equal (<= or le)</li> |
---|
30 | <li>Greater-than-or-equal (>= or ge)</li> |
---|
31 | <li>Equal (== or eq)</li> |
---|
32 | <li>Not Equal (!= or ne)</li> |
---|
33 | </ul> |
---|
34 | <blockquote> |
---|
35 | <u><b>Numeric</b></u> |
---|
36 | <code> |
---|
37 | <table border="1"> |
---|
38 | <thead> |
---|
39 | <td><b>EL Expression</b></td> |
---|
40 | <td><b>Result</b></td> |
---|
41 | </thead> |
---|
42 | <tr> |
---|
43 | <td>\${1 < 2}</td> |
---|
44 | <td>${1 < 2}</td> |
---|
45 | </tr> |
---|
46 | <tr> |
---|
47 | <td>\${1 lt 2}</td> |
---|
48 | <td>${1 lt 2}</td> |
---|
49 | </tr> |
---|
50 | <tr> |
---|
51 | <td>\${1 > (4/2)}</td> |
---|
52 | <td>${1 > (4/2)}</td> |
---|
53 | </tr> |
---|
54 | <tr> |
---|
55 | <td>\${1 > (4/2)}</td> |
---|
56 | <td>${1 > (4/2)}</td> |
---|
57 | </tr> |
---|
58 | <tr> |
---|
59 | <td>\${4.0 >= 3}</td> |
---|
60 | <td>${4.0 >= 3}</td> |
---|
61 | </tr> |
---|
62 | <tr> |
---|
63 | <td>\${4.0 ge 3}</td> |
---|
64 | <td>${4.0 ge 3}</td> |
---|
65 | </tr> |
---|
66 | <tr> |
---|
67 | <td>\${4 <= 3}</td> |
---|
68 | <td>${4 <= 3}</td> |
---|
69 | </tr> |
---|
70 | <tr> |
---|
71 | <td>\${4 le 3}</td> |
---|
72 | <td>${4 le 3}</td> |
---|
73 | </tr> |
---|
74 | <tr> |
---|
75 | <td>\${100.0 == 100}</td> |
---|
76 | <td>${100.0 == 100}</td> |
---|
77 | </tr> |
---|
78 | <tr> |
---|
79 | <td>\${100.0 eq 100}</td> |
---|
80 | <td>${100.0 eq 100}</td> |
---|
81 | </tr> |
---|
82 | <tr> |
---|
83 | <td>\${(10*10) != 100}</td> |
---|
84 | <td>${(10*10) != 100}</td> |
---|
85 | </tr> |
---|
86 | <tr> |
---|
87 | <td>\${(10*10) ne 100}</td> |
---|
88 | <td>${(10*10) ne 100}</td> |
---|
89 | </tr> |
---|
90 | </table> |
---|
91 | </code> |
---|
92 | <br> |
---|
93 | <u><b>Alphabetic</b></u> |
---|
94 | <code> |
---|
95 | <table border="1"> |
---|
96 | <thead> |
---|
97 | <td><b>EL Expression</b></td> |
---|
98 | <td><b>Result</b></td> |
---|
99 | </thead> |
---|
100 | <tr> |
---|
101 | <td>\${'a' < 'b'}</td> |
---|
102 | <td>${'a' < 'b'}</td> |
---|
103 | </tr> |
---|
104 | <tr> |
---|
105 | <td>\${'hip' > 'hit'}</td> |
---|
106 | <td>${'hip' > 'hit'}</td> |
---|
107 | </tr> |
---|
108 | <tr> |
---|
109 | <td>\${'4' > 3}</td> |
---|
110 | <td>${'4' > 3}</td> |
---|
111 | </tr> |
---|
112 | </table> |
---|
113 | </code> |
---|
114 | </blockquote> |
---|
115 | </body> |
---|
116 | </html> |
---|