A simple jsp to demonstrate how to use Arithmetic Operations in Expression Language ( el ).
Output of the Jsp Page :
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="background-color: lightblue">
<h2>Arithmetic Operations with EL !</h2>
<table border="2">
<thead>
<tr>
<th>Operation</th>
<th>EL Expression</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>Digit</td>
<td>\${8}</td>
<td>${8}</td>
</tr>
<tr>
<td>Addition</td>
<td>\${4+4}</td>
<td>${4+4}</td>
</tr>
<tr>
<td>Addition</td>
<td>\${5.5+4.5}</td>
<td>${5.5+4.5}</td>
</tr>
<tr>
<td>Subtraction</td>
<td>\${15-5}</td>
<td>${15-5}</td>
</tr>
<tr>
<td>Division</td>
<td>\${20/4}</td>
<td>${20/4}</td>
</tr>
<tr>
<td>Multiplication</td>
<td>\${2*4}</td>
<td>${2*4}</td>
</tr>
<tr>
<td>Modulus</td>
<td>\${21%4}</td>
<td>${21%4}</td>
</tr>
</tbody>
</table>
</body>
</html>
Output of the Jsp Page :
