{"id":890,"date":"2010-10-01T12:29:27","date_gmt":"2010-10-01T12:29:27","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=890"},"modified":"2010-10-01T12:29:27","modified_gmt":"2010-10-01T12:29:27","slug":"ei%e8%af%ad%e6%b3%95","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/01\/ei%e8%af%ad%e6%b3%95\/","title":{"rendered":"EI\u8bed\u6cd5"},"content":{"rendered":"<blockquote><p><span style=\"font-size: x-small;\">EI<\/span><span style=\"font-size: x-small;\">\u662fjsp-2.0\u89c4\u8303\u7684\u4e00\u90e8\u5206\uff0ctomcat-5.x\u7248\u672c\u4ee5\u4e0a\u90fd\u5df2\u7ecf\u80fd\u591f\u652f\u6301jsp-2.0\u89c4\u8303,<\/span><br \/>\n&lt;%@ page isELIgnored=&#8221;true&#8221; %&gt; \u8868\u793a\u662f\u5426\u7981\u7528EL\u8bed\u8a00,TRUE\u8868\u793a\u7981\u6b62.FALSE\u8868\u793a\u4e0d\u7981\u6b62.JSP2.0\u4e2d\u9ed8\u8ba4\u7684\u542f\u7528EL\u8bed\u8a00\u3002<\/p>\n<p><span style=\"font-size: x-small;\">.\u8bed\u6cd5\u7ed3\u6784<\/span><span style=\"font-size: x-small;\">\uff081\uff09\u4f7f\u7528el\u7684\u65f6\u5019\uff0c\u9ed8\u8ba4\u4f1a\u4ee5\u4e00\u5b9a\u987a\u5e8f\u641c\u7d22\u56db\u4e2a\u4f5c\u7528\u57df\uff0c\u5c06\u6700\u5148\u627e\u5230\u7684\u53d8\u91cf\u503c\u663e\u793a\u51fa\u6765\u3002<\/span><\/p>\n<p>??? ${expression}<\/p>\n<p>1\uff0c\u4e0e\u9875\u9762\u5143\u7d20\u7684\u64cd\u4f5c\uff1a<br \/>\n??<\/p>\n<div><span style=\"font-size: small;\"><img decoding=\"async\" src=\"http:\/\/www.family168.com\/tutorial\/jsp\/shared\/images\/jsp-ch-13-02-scope-01.png\" alt=\"\" align=\"middle\" \/><\/span><\/div>\n<p><span style=\"font-size: x-small;\">\u5982\u679c\u6211\u4eec\u6709${username}\u8fd9\u6837\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5b83\u56de\u53bb\u4f9d\u6b21\u8c03\u7528pageContext.getAttribute(&#8220;username&#8221;) -&gt; request.getAttribute(&#8220;username&#8221;) -&gt; session.getAttribute(&#8220;username&#8221;) -&gt; application.getAttribute(&#8220;username&#8221;)\uff0c\u53ea\u8981\u627e\u5230\u67d0\u4e00\u4e2a\u4e0d\u4e3a\u7a7a\u7684\u503c\u5c31\u7acb\u523b\u8fd4\u56de\u3002<\/span><\/p>\n<p><span style=\"font-size: small;\"><span style=\"font-size: x-small;\">?\uff082\uff09\u6307\u5b9a\u5177\u4f53\u7684\u57df <\/span><br \/>\n<\/span><\/p>\n<p><span style=\"font-size: small;\">?????? <\/span><\/p>\n<table border=\"1\">\n<thead>\n<tr>\n<th align=\"center\">el\u4e2d\u7684\u4f5c\u7528\u57df<\/th>\n<th align=\"center\">\u5bf9\u5e94\u5173\u7cfb<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\">pageContext(1)<\/td>\n<td align=\"center\">\u5f53\u524d\u9875\u7684pageContext\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">pageScope<\/td>\n<td align=\"center\">\u628apage\u4f5c\u7528\u57df\u4e2d\u7684\u6570\u636e\u6620\u5c04\u4e3a\u4e00\u4e2amap\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">requestScope(2)<\/td>\n<td align=\"center\">\u628arequest\u4f5c\u7528\u57df\u4e2d\u7684\u6570\u636e\u6620\u5c04\u4e3a\u4e00\u4e2amap\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">sessionScope<\/td>\n<td align=\"center\">\u628asession\u4f5c\u7528\u57df\u4e2d\u7684\u6570\u636e\u6620\u5c04\u4e3a\u4e00\u4e2amap\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">applicationScope<\/td>\n<td align=\"center\">\u628aapplication\u4f5c\u7528\u57df\u4e2d\u7684\u6570\u636e\u6620\u5c04\u4e3a\u4e00\u4e2amap\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">param<\/td>\n<td align=\"center\">\u5bf9\u5e94request.getParameter()<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">paramValues(3)<\/td>\n<td align=\"center\">\u5bf9\u5e94request.getParameterValues()<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">header(4)<\/td>\n<td align=\"center\">\u5bf9\u5e94request.getHeader()<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">headerValues<\/td>\n<td align=\"center\">\u5bf9\u5e94request.getHeaderValues()<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">cookie(5)<\/td>\n<td align=\"center\">\u5bf9\u5e94request.getCookies()<\/td>\n<\/tr>\n<tr>\n<td align=\"center\">initParam(6)<\/td>\n<td align=\"center\">\u5bf9\u5e94ServletContext.getInitParamter()<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>?? session.getAttribute(&#8220;username&#8221;)?? \u7b49\u540c\u4e8e ${sessionScope:username}<\/p>\n<p>?? request.getParameter(String name)? \u7b49\u540c\u4e8e ${param:name}<\/p>\n<p>\uff083\uff09EI\u8fd0\u7b97\u7b26<\/p>\n<p>???? ${ 1 + 2 }? \u7ed3\u679c\uff1a3<\/p>\n<p>???? ${ 1 &lt;= 2 } \u7ed3\u679c\uff1a true<\/p>\n<p>??? ${ true &amp;&amp; false } \u7ed3\u679c\uff1afalse<\/p>\n<p>??? ${ empty 2 } \u7ed3\u679c\uff1afalse \/\/\u5224\u65ad\u5bf9\u8c61\u662f\u5426\u4e3a\u7a7a<\/p>\n<p>??? ${ not empty 2 }\u7ed3\u679c\uff1atrue<\/p>\n<p>?? ${ 2&gt;1 ? &#8220;yes&#8221; : &#8220;no&#8221; }<\/p>\n<p>? \u5bf9string\u7c7b\u578b\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<p>? ${fn:substring(booking.orderId,0,6)}<\/p>\n<p>?? fn:contains(string, substring)? fn:endsWith(string, suffix)?? fn:length(item)? fn:split(string, separator)? fn:trim(string)<\/p>\n<p>\uff084\uff09\u8c03\u7528\u5bf9\u8c61\u65b9\u6cd5<\/p>\n<p>&lt;c:forEach var=&#8221;modules&#8221; items=&#8221;${SES_powers.modules}&#8221; varStatus=&#8221;status&#8221;&gt;<br \/>\n?????<strong> &#8230;<\/strong><br \/>\n? &lt;\/c:forEach&gt;<\/p>\n<p>SES_powers.modules \u4f1a\u81ea\u52a8\u8c03\u7528SES_powers\u7684getModules()\u65b9\u6cd5\uff0c\uff08\u5373\u4f7f\u6ca1\u6709modules\u8fd9\u4e2a\u53d8\u91cf\uff09\uff0c\u8fd9\u6837\u907f\u514d\u4e86\u5728\u9875\u9762\u4e2d\u5f15\u7528JAVA\u4ee3\u7801<\/p>\n<p><span style=\"font-size: small;\"><span style=\"font-size: x-small;\">\u6ce8\uff1a\u5411\u65b9\u6cd5\u4e2d\u4f20\u53c2<\/span>\uff1a<span style=\"font-size: x-small;\"><a href=\"http:\/\/tech.ddvip.com\/2009-04\/1238857014113535.html\">http:\/\/tech.ddvip.com\/2009-04\/1238857014113535.html<\/a><\/span><\/span><\/p>\n<p><span style=\"font-size: small;\">\u4e00\u822c\u6700\u597d\u5728\u7a0b\u5e8f\u4e2d\u5c31\u5c06\u6570\u636e\u53d6\u51fa\uff0c\u5728JSP\u9875\u9762\u53ea\u8fdb\u884c\u8bfb\u53d6\u6570\u636e\u7684\u64cd\u4f5c<\/span><\/p>\n<p><span style=\"font-size: small;\">(5)\u96c6\u5408\u64cd\u4f5c<\/span><\/p>\n<p>Map<br \/>\nMap mapValue? = new HashMap();<br \/>\n?? mapValue.put(&#8220;key1&#8221;, &#8220;value1&#8221;);<br \/>\n?? mapValue.put(&#8220;key2&#8221;, &#8220;value2&#8221;);<\/p>\n<p>request.setAttribute(&#8220;mapvalue&#8221;, mapValue);<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;El\u8868\u8fbe\u5f0f\u83b7\u53d6<br \/>\n&lt;li&gt;\u8f93\u51famap,\u91c7\u7528.\u8fdb\u884c\u5bfc\u822a\uff0c\u4e5f\u79f0\u5b58\u53d6\u5668&lt;\/li&gt;&lt;br&gt;<br \/>\nmapvalue.key1:${mapvalue.key1 }&lt;br&gt;<br \/>\nmapvalue.key2:${mapvalue.key2 }&lt;br&gt;<\/p>\n<p>?List<\/p>\n<p>${userlist[4].username }<\/p>\n<p>(6)\u6570\u7ec4<\/p>\n<p>? User[] users = new User[10];<\/p>\n<p>${users[2].username }<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>EI\u662fjsp-2.0\u89c4\u8303\u7684\u4e00\u90e8\u5206\uff0ctomcat-5.x\u7248\u672c\u4ee5\u4e0a\u90fd\u5df2\u7ecf\u80fd\u591f\u652f\u6301jsp-2.0\u89c4\u8303, &lt;%@ [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-890","post","type-post","status-publish","format-standard","hentry","category-struts2-0"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=890"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/890\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}