source: nutchez-0.1/tomcat/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp.html @ 68

Last change on this file since 68 was 66, checked in by waue, 15 years ago

NutchEz - an easy way to nutch

File size: 2.5 KB
Line 
1<html><body><pre>
2&lt;!--
3 Licensed to the Apache Software Foundation (ASF) under one or more
4  contributor license agreements.  See the NOTICE file distributed with
5  this work for additional information regarding copyright ownership.
6  The ASF licenses this file to You under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with
8  the License.  You may obtain a copy of the License at
9
10      http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17-->
18&lt;html>
19  &lt;head>
20    &lt;title>JSP 2.0 Expression Language - Basic Arithmetic&lt;/title>
21  &lt;/head>
22  &lt;body>
23    &lt;h1>JSP 2.0 Expression Language - Basic Arithmetic&lt;/h1>
24    &lt;hr>
25    This example illustrates basic Expression Language arithmetic.
26    Addition (+), subtraction (-), multiplication (*), division (/ or div),
27    and modulus (% or mod) are all supported.  Error conditions, like
28    division by zero, are handled gracefully.
29    &lt;br>
30    &lt;blockquote>
31      &lt;code>
32        &lt;table border="1">
33          &lt;thead>
34      &lt;td>&lt;b>EL Expression&lt;/b>&lt;/td>
35      &lt;td>&lt;b>Result&lt;/b>&lt;/td>
36    &lt;/thead>
37    &lt;tr>
38      &lt;td>\${1}&lt;/td>
39      &lt;td>${1}&lt;/td>
40    &lt;/tr>
41    &lt;tr>
42      &lt;td>\${1 + 2}&lt;/td>
43      &lt;td>${1 + 2}&lt;/td>
44    &lt;/tr>
45    &lt;tr>
46      &lt;td>\${1.2 + 2.3}&lt;/td>
47      &lt;td>${1.2 + 2.3}&lt;/td>
48    &lt;/tr>
49    &lt;tr>
50      &lt;td>\${1.2E4 + 1.4}&lt;/td>
51      &lt;td>${1.2E4 + 1.4}&lt;/td>
52    &lt;/tr>
53    &lt;tr>
54      &lt;td>\${-4 - 2}&lt;/td>
55      &lt;td>${-4 - 2}&lt;/td>
56    &lt;/tr>
57    &lt;tr>
58      &lt;td>\${21 * 2}&lt;/td>
59      &lt;td>${21 * 2}&lt;/td>
60    &lt;/tr>
61    &lt;tr>
62      &lt;td>\${3/4}&lt;/td>
63      &lt;td>${3/4}&lt;/td>
64    &lt;/tr>
65    &lt;tr>
66      &lt;td>\${3 div 4}&lt;/td>
67      &lt;td>${3 div 4}&lt;/td>
68    &lt;/tr>
69    &lt;tr>
70      &lt;td>\${3/0}&lt;/td>
71      &lt;td>${3/0}&lt;/td>
72    &lt;/tr>
73    &lt;tr>
74      &lt;td>\${10%4}&lt;/td>
75      &lt;td>${10%4}&lt;/td>
76    &lt;/tr>
77    &lt;tr>
78      &lt;td>\${10 mod 4}&lt;/td>
79      &lt;td>${10 mod 4}&lt;/td>
80    &lt;/tr>
81    &lt;tr>
82      &lt;td>\${(1==2) ? 3 : 4}&lt;/td>
83      &lt;td>${(1==2) ? 3 : 4}&lt;/td>
84    &lt;/tr>
85  &lt;/table>
86      &lt;/code>
87    &lt;/blockquote>
88  &lt;/body>
89&lt;/html>
90</pre></body></html>
Note: See TracBrowser for help on using the repository browser.