{"id":1173,"date":"2018-04-21T12:05:36","date_gmt":"2018-04-21T03:05:36","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=1173"},"modified":"2023-05-27T20:44:04","modified_gmt":"2023-05-27T11:44:04","slug":"%e3%80%90jsp%e3%80%91el%e5%bc%8f%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=1173","title":{"rendered":"\u3010JSP\u3011EL\u5f0f\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p>EL\u5f0f\u306f\u3001<span style=\"color: #ff0000;\"><strong>\u7c21\u6f54\u306a\u8868\u73fe\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u304c\u3067\u304d\u308b\u8a00\u8a9e<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306a\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u304d\u307e\u3059\u3002<\/p>\n<h2>\u57fa\u672c\u7684\u306aEL\u5f0f\u306e\u69cb\u6587<\/h2>\n<p>\u57fa\u672c\u7684\u306b\u306f\u3001\u300c<strong>${\uff5e}<\/strong>\u300d\u3068\u3044\u3046\u69cb\u6587\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h3>\u6587\u5b57\u5217\u3092\u51fa\u529b\u3059\u308b\u5834\u5408<\/h3>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n${&quot;HelloWorld&quot;}\r\n<\/pre>\n<p>\u30c0\u30d6\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3046\u304b\u3001\u30b7\u30f3\u30b0\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3044\u307e\u3059\u3002<\/p>\n<h3>\u6570\u5b57\u3092\u51fa\u529b\u3059\u308b\u5834\u5408<\/h3>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n${123}\r\n<\/pre>\n<p>\u6570\u5b57\u306e\u5834\u5408\u306f\u3001\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u3067\u540c\u3058\u3053\u3068\u3092\u3057\u3088\u3046\u3068\u3057\u305f\u5834\u5408<\/h3>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u3067\u540c\u3058\u3053\u3068\u3092\u3057\u3088\u3046\u3068\u3057\u305f\u5834\u5408\u306f\u3001\u305d\u308c\u305e\u308c\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u8a18\u8ff0\u304c\u3060\u3044\u3076\u7c21\u6f54\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;% out.print(&quot;HelloWorld&quot;); %&gt;\r\n&lt;% out.print(123); %&gt;\r\n<\/pre>\n<h2>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8(\u30b9\u30b3\u30fc\u30d7\u5909\u6570)\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/h2>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u3067\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u30b9\u30b3\u30fc\u30d7\u306b\u683c\u7d0d\u3057\u305f\u5024\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;% out.print(request.getAttribute(&quot;name&quot;)); %&gt;\r\n<\/pre>\n<p>EL\u5f0f\u3067\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n${name}\r\n<\/pre>\n<h3>\u691c\u7d22\u3055\u308c\u308b\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u306e\u4ed5\u69d8\u306b\u3064\u3044\u3066<\/h3>\n<p>\u306a\u304a\u3001\u30b9\u30b3\u30fc\u30d7\u306b\u3082\u8272\u3005\u3068\u7a2e\u985e\u304c\u3042\u3063\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<span style=\"color: #ff0000;\"><strong>\u72ed\u3044\u65b9\u304b\u3089\u9806\u756a\u306b\u691c\u7d22\u3055\u308c\u307e\u3059\u3002<\/strong><\/span><\/p>\n<div class=\"graybox\">\u30da\u30fc\u30b8\u2192\u30ea\u30af\u30a8\u30b9\u30c8\u2192\u30bb\u30c3\u30b7\u30e7\u30f3\u2192\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/div>\n<div><\/div>\n<div>\u30b9\u30b3\u30fc\u30d7\u306b\u3064\u3044\u3066\u30a4\u30de\u30a4\u30c1\u3074\u3093\u3068\u6765\u306a\u3044\u65b9\u306f\u3001\u4e0b\u8a18\u306e\u8a18\u4e8b\u3067\u3082\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3054\u53c2\u7167\u4e0b\u3055\u3044\u3002<\/div>\n<div><\/div>\n<blockquote class=\"wp-embedded-content\" data-secret=\"0fmtpnZySW\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=1052\">\u3010\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u3011\u30b9\u30b3\u30fc\u30d7\u306b\u3064\u3044\u3066<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=1052&#038;embed=true#?secret=0fmtpnZySW\" data-secret=\"0fmtpnZySW\" width=\"500\" height=\"282\" title=\"&#8220;\u3010\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u3011\u30b9\u30b3\u30fc\u30d7\u306b\u3064\u3044\u3066&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h3>null\u306b\u3064\u3044\u3066<\/h3>\n<div>\u00a0\u3067\u306f\u3001\u3082\u3057\u5909\u6570\u306e\u4e2d\u306b\u5024\u304c\u5165\u3063\u3066\u3044\u306a\u304b\u3063\u305f\u5834\u5408\u306f\u3069\u306e\u3088\u3046\u306a\u6319\u52d5\u306b\u306a\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/div>\n<div><\/div>\n<div>\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u3067\u306f\u3001null\u304c\u5e30\u3063\u3066\u304d\u3066\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>EL\u5f0f\u3067\u306f\u4f55\u3082\u8868\u793a\u3055\u308c\u306a\u3044\u6319\u52d5\u3068\u306a\u308a\u307e\u3059\u3002<\/strong><\/span><\/div>\n<div><\/div>\n<h2>\u00a0JavaBeans\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/h2>\n<p>\u4f8b\u3048\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u3067\u3001JavaBeans\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u30bd\u30fc\u30b9\u304c\u3042\u3063\u305f\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3054\u3061\u3083\u3054\u3061\u3083\u306a\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<pre><strong>bean.jsp<\/strong><\/pre>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;%@page contentType=&quot;text\/html; charset=UTF-8&quot; %&gt;\r\n&lt;%@page import=&quot;bean.*&quot; %&gt;\r\n\r\n&lt;HTML&gt;\r\n&lt;HEAD&gt;\r\n&lt;TITLE&gt;BeanTest&lt;\/TITLE&gt;\r\n&lt;\/HEAD&gt;\r\n&lt;BODY&gt;\r\n\r\n&lt;% TestBean bean = new TestBean(); bean.setName(&quot;\u592a\u90ce&quot;); request.setAttribute(&quot;bean&quot;,bean); %&gt;\r\n\r\n\u540d\u524d\u306f\u3001&lt;% out.print(((TestBean)request.getAttribute(&quot;bean&quot;)).getName()); %&gt;\u3067\u3059\u3002\r\n\r\n&lt;\/BODY&gt;\r\n&lt;\/HTML&gt;\r\n<\/pre>\n<p><strong>TestBean.java(JavaBeans)<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage bean;\r\n\r\npublic class TestBean {\r\n\r\n\tprivate String name;\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>EL\u5f0f\u306b\u76f4\u3059\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<span style=\"color: #ff0000;\"><strong>\u975e\u5e38\u306b\u7c21\u7d20\u306a\u5f62\u3067\u3001JavaBeans\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n\u540d\u524d\u306f\u3001${bean.name}\u3067\u3059\u3002\r\n<\/pre>\n<p>\u305f\u3060\u3001\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001<span style=\"color: #ff0000;\"><strong>JavaBeans\u304b\u3089\u3001\u30b2\u30c3\u30bf\u30fc\u30e1\u30bd\u30c3\u30c9\u3092\u524a\u9664\u3057\u3066\u3057\u307e\u3046\u3068EL\u5f0f\u304c\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u5fc5\u305a\u30b2\u30c3\u30bf\u30fc\u30e1\u30bd\u30c3\u30c9\u3092\u8a18\u8ff0\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002<\/strong><\/span><\/p>\n<h2>EL\u5f0f\u306e\u6697\u9ed9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h2>\n<p>EL\u5f0f\u306b\u3082\u3001<span style=\"color: #ff0000;\"><strong>\u901a\u5e38\u306eJSP\u3068\u306f\u5225\u306bEL\u5f0f\u5c02\u7528\u306e\u6697\u9ed9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>EL\u5f0f\u306e\u6697\u9ed9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4e00\u89a7\u3067\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u540d\u524d<\/th>\n<th>\u8aac\u660e<\/th>\n<\/tr>\n<tr>\n<td>pageContext<\/td>\n<td>PageContext\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/td>\n<\/tr>\n<tr>\n<td>pageScope<\/td>\n<td>\u00a0\u30da\u30fc\u30b8\u30b9\u30b3\u30fc\u30d7\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>requestScope<\/td>\n<td>\u30ea\u30af\u30a8\u30b9\u30c8\u30b9\u30b3\u30fc\u30d7\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>sessionScope<\/td>\n<td>\u30bb\u30c3\u30b7\u30e7\u30f3\u30b9\u30b3\u30fc\u30d7\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>applicationScope<\/td>\n<td>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b9\u30b3\u30fc\u30d7\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>param<\/td>\n<td>\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>paramValue<\/td>\n<td>\u8907\u6570\u306e\u5024\u3092\u6301\u3064\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>header<\/td>\n<td>\u30d8\u30c3\u30c0\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>headerValue<\/td>\n<td>\u8907\u6570\u306e\u5024\u3092\u6301\u3064\u30d8\u30c3\u30c0\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>initParam<\/td>\n<td>\u521d\u671f\u30d1\u30e9\u30e1\u30fc\u30bf\u306eMap<\/td>\n<\/tr>\n<tr>\n<td>cookie<\/td>\n<td>\u30af\u30c3\u30ad\u30fc\u306e\u540d\u524d\u3068\u5024\u306eMap<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4f8b\u3048\u3070\u2026<\/h3>\n<p>\u30ea\u30af\u30a8\u30b9\u30c8\u30b9\u30b3\u30fc\u30d7\u306e\u6697\u9ed9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304b\u3089\u3001\u5024\u3092\u53d6\u5f97\u3059\u308b\u5834\u5408\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">{$requestScope.(\u5024)}<\/pre>\n<h2>EL\u5f0f\u3067\u3001\u6761\u4ef6\u5206\u5c90\u3084\u3001\u30eb\u30fc\u30d7\u6587\u3092\u4f7f\u3046\u306b\u306f\uff1f<\/h2>\n<p>EL\u5f0f\u306e\u5236\u7d04\u3068\u3057\u3066\u3001<span style=\"color: #ff0000;\"><strong>\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u5185(&lt;% \uff5e %&gt;)\u3067\u306f\u4f7f\u7528\u3067\u304d\u306a\u3044\u70b9<\/strong><\/span>\u3068\u3044\u3046\u306e\u304c\u3042\u308a\u307e\u3059\u3002\uff08\u3082\u3057\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u30ec\u30c3\u30c8\u5185\u3067\u4f7f\u3063\u3066\u3057\u307e\u3046\u3068\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\uff09<\/p>\n<p>\u3082\u3057\u3001EL\u5f0f\u3067\u3001\u7e70\u308a\u8fd4\u3057\u5206\u3084\u3001\u6761\u4ef6\u5206\u5c90\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u306f\u3001<span style=\"color: #ff0000;\"><strong>JSTL<\/strong><\/span>\u3068\u3044\u3046\u30ab\u30b9\u30bf\u30e0\u30bf\u30b0\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>JSTL\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u306f\u4e0b\u8a18\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"71mDBgmoKM\"><p><a href=\"http:\/\/www.code-magagine.com\/?p=1193\">\u3010JSP\u3011JSTL\u3092\u4f7f\u3046\u306b\u306f\uff1f(\u30ab\u30b9\u30bf\u30e0\u30bf\u30b0\u306e\u57fa\u672c\u3084\u7a2e\u985e\u306b\u3064\u3044\u3066\u3082\uff09<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/www.code-magagine.com\/?p=1193&#038;embed=true#?secret=71mDBgmoKM\" data-secret=\"71mDBgmoKM\" width=\"500\" height=\"282\" title=\"&#8220;\u3010JSP\u3011JSTL\u3092\u4f7f\u3046\u306b\u306f\uff1f(\u30ab\u30b9\u30bf\u30e0\u30bf\u30b0\u306e\u57fa\u672c\u3084\u7a2e\u985e\u306b\u3064\u3044\u3066\u3082\uff09&#8221; &#8212; \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30de\u30ac\u30b8\u30f3\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"EL\u5f0f\u306f\u3001\u7c21\u6f54\u306a\u8868\u73fe\u3067\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u304c\u3067\u304d\u308b\u8a00\u8a9e\u3067\u3059\u3002 \u5177\u4f53\u7684\u306a\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u3066\u304d\u307e\u3059\u3002 \u57fa\u672c\u7684\u306aEL\u5f0f\u306e\u69cb\u6587 \u57fa\u672c\u7684\u306b\u306f\u3001\u300c${\uff5e}\u300d\u3068\u3044\u3046\u69cb\u6587\u3092\u4f7f\u3044\u307e\u3059\u3002 \u6587\u5b57\u5217\u3092\u51fa\u529b\u3059\u308b\u5834\u5408 \u30c0\u30d6\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2 [&hellip;]","protected":false},"author":1,"featured_media":1404,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1173"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1173"}],"version-history":[{"count":17,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1173\/revisions"}],"predecessor-version":[{"id":20254,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/1173\/revisions\/20254"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/1404"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}