<%@ page contentType="text/html;charset=MS932" %>

<html>

<head>
<title>EL Operator Example</title>
</head>

<body>

<%-- 配列定義 --%>
<% pageContext.setAttribute("array",new String[]{"零","壱","弐","参"}); %>

<%-- Map定義 --%>
<% java.util.Map month = new java.util.HashMap();
   month.put("Oct","31");
   month.put("Nov","30");
   month.put("Dec","31");
   pageContext.setAttribute("map",month);
%>
<%-- 空オブジェクト --%>
<%
   pageContext.setAttribute("null"            ,null);
   pageContext.setAttribute("nullString"      ,"");
   pageContext.setAttribute("emptyArray"      ,new String[0]);
   pageContext.setAttribute("emptyCollection" ,new java.util.LinkedList());
   pageContext.setAttribute("emptyMap"        ,new java.util.HashMap());
%>

<table><tr><td>

<table border="1">
<tr><th>優先順位</th><th>演算子</th><th>EL式</th><th>値</th></tr>
<tr><td>1</td> <td>配列添字</td> <td>\${array[1]}</td> <td>${array[1]}</td></tr>
<tr><td>2</td> <td>要素指定</td> <td>\${map.Nov}</td>  <td>${map.Nov}</td></tr>
<tr><td>3</td> <td>括弧</td>     <td>\${-(1+2)}</td>   <td>${-(1+2)}</td></tr>
<tr><td>4</td> <td>負号</td>     <td>\${-1+2}</td>     <td>${-1+2}</td></tr>
<!-- =================== -->
<tr>
  <td rowspan="2">5</td> 
  <td rowspan="2">否定</td>     
  <td>\${!(true)}</td>
  <td>${!(true)}</td>
</tr>
<tr>
  <td>\${not(true)}</td>
  <td>${not(true)}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="5">6</td>
  <td rowspan="5">空か?</td>
  <td>\${empty nullObject}</td>
  <td>${empty nullObject}</td>
</tr>
<tr>
  <td>\${empty emptyString}</td>
  <td>${empty emptyString}</td>
</tr>
<tr>
  <td>\${empty emptyArray}</td>
  <td>${empty emptyArray}</td>
</tr>
<tr>
  <td>\${empty emptyCollection}</td>
  <td>${empty emptyCollection}</td>
</tr>
<tr>
  <td>\${empty emptyMap}</td>
  <td>${empty emptyMap}</td>
</tr>
<!-- =================== -->
<tr><td>7</td><td>乗算</td><td>\${6 + 5 * 4}</td><td>${6+5*4}</td></tr>
<!-- =================== -->
<tr>
  <td rowspan="2">8</td> 
  <td rowspan="2">除算</td>     
  <td>\${6 + 5 / 4}</td>
  <td>${6+5/4}</td>
</tr>
<tr>
  <td>\${6 + 5 div 4}</td>
  <td>${6 + 5 div 4}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">9</td> 
  <td rowspan="2">剰余算</td>     
  <td>\${6 + 5 % 4}</td>
  <td>${6+5%4}</td>
</tr>
<tr>
  <td>\${6 + 5 mod 4}</td>
  <td>${6 + 5 mod 4}</td>
</tr>
<!-- =================== -->
<tr><td>10</td><td>加算</td><td>\${1 + 2}</td><td>${1+2}</td></tr>
<!-- =================== -->
<tr><td>11</td><td>減算</td><td>\${1 - 2}</td><td>${1-2}</td></tr>
</table>

</td><td>

<table border="1">
<tr><th>優先順位</th><th>演算子</th><th>EL式</th><th>値</th></tr>
<tr>
  <td rowspan="2">12</td> 
  <td rowspan="2">LessThan</td>     
  <td>\${10 < 100}</td>
  <td>${10<100}</td>
</tr>
<tr>
  <td>\${10 lt 100}</td>
  <td>${10 lt 100}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">13</td> 
  <td rowspan="2">GreaterThan</td>     
  <td>\${10 > 100}</td>
  <td>${10>100}</td>
</tr>
<tr>
  <td>\${10 gt 100}</td>
  <td>${10 gt 100}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">14</td> 
  <td rowspan="2">LessEqual</td>     
  <td>\${10 <= 10}</td>
  <td>${10<=10}</td>
</tr>
<tr>
  <td>\${10 le 10}</td>
  <td>${10 le 10}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">15</td> 
  <td rowspan="2">GreaterEqual</td>     
  <td>\${10 >= 10}</td>
  <td>${10>=10}</td>
</tr>
<tr>
  <td>\${10 ge 10}</td>
  <td>${10 ge 10}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">16</td> 
  <td rowspan="2">Equal</td>     
  <td>\${10 == 10}</td>
  <td>${10==10}</td>
</tr>
<tr>
  <td>\${10 eq 10}</td>
  <td>${10 eq 10}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">17</td> 
  <td rowspan="2">NotEqual</td>     
  <td>\${10 != 10}</td>
  <td>${10!=10}</td>
</tr>
<tr>
  <td>\${10 ne 10}</td>
  <td>${10 ne 10}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">18</td> 
  <td rowspan="2">論理積</td>     
  <td>\${true && false}</td>
  <td>${true && false}</td>
</tr>
<tr>
  <td>\${true and false}</td>
  <td>${true and false}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">19</td> 
  <td rowspan="2">論理和</td>     
  <td>\${true || false}</td>
  <td>${true || false}</td>
</tr>
<tr>
  <td>\${true or false}</td>
  <td>${true or false}</td>
</tr>
<!-- =================== -->
<tr>
  <td rowspan="2">20</td> 
  <td rowspan="2">三項演算子</td>     
  <td>\${true ? "是" : "非"}</td>
  <td>${true ? "是" : "非"}</td>
</tr>
<tr>
  <td>\${false ? "是" : "非"}</td>
  <td>${false ? "是" : "非"}</td>
</tr>
</table>

</td></tr></table>

</body>

</html>

Java SJC-WC JSP


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2009-10-26 (月) 23:15:26 (2597d)
ISBN10
ISBN13
9784061426061