﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-clingingboy-随笔分类-JSP基础</title><link>http://www.blogjava.net/clingingboy/category/12189.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 08:10:45 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 08:10:45 GMT</pubDate><ttl>60</ttl><item><title>JSP表达式语言</title><link>http://www.blogjava.net/clingingboy/archive/2006/06/15/53091.html</link><dc:creator>clingingboy</dc:creator><author>clingingboy</author><pubDate>Thu, 15 Jun 2006 13:21:00 GMT</pubDate><guid>http://www.blogjava.net/clingingboy/archive/2006/06/15/53091.html</guid><wfw:comment>http://www.blogjava.net/clingingboy/comments/53091.html</wfw:comment><comments>http://www.blogjava.net/clingingboy/archive/2006/06/15/53091.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/clingingboy/comments/commentRss/53091.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/clingingboy/services/trackbacks/53091.html</trackback:ping><description><![CDATA[ 看其本身自带的例子<br /><br />1，
<table border="1"><thead><tr><td><b>EL Expression</b></td><td><b>Result</b></td></tr></thead><tbody><tr><td>${1}</td><td>1</td></tr><tr><td>${1 + 2}</td><td>3</td></tr><tr><td>${1.2 + 2.3}</td><td>3.5</td></tr><tr><td>${1.2E4 + 1.4}</td><td>12001.4</td></tr><tr><td>${-4 - 2}</td><td>-6</td></tr><tr><td>${21 * 2}</td><td>42</td></tr><tr><td>${3/4}</td><td>0.75</td></tr><tr><td>${3 div 4}</td><td>0.75</td></tr><tr><td>${3/0}</td><td>Infinity</td></tr><tr><td>${10%4}</td><td>2</td></tr><tr><td>${10 mod 4}</td><td>2</td></tr><tr><td>${(1==2) ? 3 : 4}</td><td>4</td></tr></tbody></table><br />2，<br /><table border="1"><thead><tr><td><b>EL Expression</b></td><td><b>Result</b></td></tr></thead><tbody><tr><td>${1 &lt; 2}</td><td>true</td></tr><tr><td>${1 lt 2}</td><td>true</td></tr><tr><td>${1 &gt; (4/2)}</td><td>false</td></tr><tr><td>${1 &gt; (4/2)}</td><td>false</td></tr><tr><td>${4.0 &gt;= 3}</td><td>true</td></tr><tr><td>${4.0 ge 3}</td><td>true</td></tr><tr><td>${4 &lt;= 3}</td><td>false</td></tr><tr><td>${4 le 3}</td><td>false</td></tr><tr><td>${100.0 == 100}</td><td>true</td></tr><tr><td>${100.0 eq 100}</td><td>true</td></tr><tr><td>${(10*10) != 100}</td><td>false</td></tr><tr><td>${(10*10) ne 100}</td><td>false</td></tr></tbody></table><br />3，<br /><table border="1"><thead><tr><td><b>EL Expression</b></td><td><b>Result</b></td></tr></thead><tbody><tr><td>${'a' &lt; 'b'}</td><td>true</td></tr><tr><td>${'hip' &gt; 'hit'}</td><td>false</td></tr><tr><td>${'4' &gt; 3}</td><td>true</td></tr></tbody></table><br />4，<br /><table border="1"><thead><tr><td><b>EL Expression</b></td><td><b>Result</b></td></tr></thead><tbody><tr><td>${param.foo}</td><td>bar </td></tr><tr><td>${param["foo"]}</td><td>bar </td></tr><tr><td>${header["host"]}</td><td>127.0.0.1:8080</td></tr><tr><td>${header["accept"]}</td><td>*/*</td></tr><tr><td>${header["user-agent"]}</td><td>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 2.0.50727)</td></tr></tbody></table><br />5,<br /><table border="1"><thead><tr><td><b>EL Expression</b></td><td><b>Result</b></td></tr></thead><tbody><tr><td>${param["foo"]}</td><td>0.2  </td></tr><tr><td>${my:reverse(param["foo"])}</td><td>2.0 </td></tr><tr><td>${my:reverse(my:reverse(param["foo"]))}</td><td>0.2  </td></tr><tr><td>${my:countVowels(param["foo"])}</td><td>0 </td></tr></tbody></table><img src ="http://www.blogjava.net/clingingboy/aggbug/53091.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/clingingboy/" target="_blank">clingingboy</a> 2006-06-15 21:21 <a href="http://www.blogjava.net/clingingboy/archive/2006/06/15/53091.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>基本脚本元素</title><link>http://www.blogjava.net/clingingboy/archive/2006/06/15/53090.html</link><dc:creator>clingingboy</dc:creator><author>clingingboy</author><pubDate>Thu, 15 Jun 2006 13:01:00 GMT</pubDate><guid>http://www.blogjava.net/clingingboy/archive/2006/06/15/53090.html</guid><wfw:comment>http://www.blogjava.net/clingingboy/comments/53090.html</wfw:comment><comments>http://www.blogjava.net/clingingboy/archive/2006/06/15/53090.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/clingingboy/comments/commentRss/53090.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/clingingboy/services/trackbacks/53090.html</trackback:ping><description><![CDATA[发些比较基础的东西<br /><br />1,声明 用于插入方法，声明变量，常量<br />2,表达式 用于输出<br />3,scriptlet  包含完整java代码段<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">声明  </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img id="Codehighlighter1_16_154_Open_Image" onclick="this.style.display='none'; Codehighlighter1_16_154_Open_Text.style.display='none'; Codehighlighter1_16_154_Closed_Image.style.display='inline'; Codehighlighter1_16_154_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_16_154_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_16_154_Closed_Text.style.display='none'; Codehighlighter1_16_154_Open_Image.style.display='inline'; Codehighlighter1_16_154_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />        </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_16_154_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_16_154_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">!<br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">String</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> a</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">clingingboy</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Date</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> myDate</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">new</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">Date</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">();<br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">private</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> static </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">String</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Add(</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">String</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> a,</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">String</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> b)<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">String</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> c</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">a</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">+</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">b;<br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        return c;<br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        </span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">表达式  </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">a</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">+</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">你好</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">this.Add(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">，现在</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">,</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">时间是</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">)</span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">myDate.getHours()</span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">myDate.getMinutes() </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000">scriptlet脚本元素  </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img id="Codehighlighter1_317_408_Open_Image" onclick="this.style.display='none'; Codehighlighter1_317_408_Open_Text.style.display='none'; Codehighlighter1_317_408_Closed_Image.style.display='inline'; Codehighlighter1_317_408_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_317_408_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_317_408_Closed_Text.style.display='none'; Codehighlighter1_317_408_Open_Image.style.display='inline'; Codehighlighter1_317_408_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />        </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_317_408_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_317_408_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">for</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">int</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> i</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">1</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;i</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&lt;=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">10</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;i</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">++</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">)<br /></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        {<br /></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        out.print(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&lt;font size=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">+</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">i</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">+</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&gt;hello,world&lt;/font&gt;&lt;br&gt;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br /></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        }<br /></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        </span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span></div><img src ="http://www.blogjava.net/clingingboy/aggbug/53090.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/clingingboy/" target="_blank">clingingboy</a> 2006-06-15 21:01 <a href="http://www.blogjava.net/clingingboy/archive/2006/06/15/53090.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>