?? 5.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://www.aspcn.com/showarticle.asp?id=81 -->
<HTML><HEAD><TITLE>jsp</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR><LINK href="5.files/aspcn.css"
rel=stylesheet type=text/css></HEAD>
<BODY>
<table border=0 width="100%">
<tbody>
<tr>
<td>5
<h2 align=center>Scriptlet</h2>
<p>包含一個有效的程序段. </p>
<a name=10998></a>
<h4>JSP 語法</h4>
<blockquote><% <em>code fragment</em> %> </blockquote>
<a
name=16389></a>
<h4>例子</h4>
<blockquote><strong><% <br>
String name = null; <br>
if (request.getParameter("name") == null) { <br>
%> <br>
</strong><%@ include file="error.html" %> <br>
<strong><% <br>
} else { <br>
foo.setName(request.getParameter("name")); <br>
if (foo.getName().equalsIgnoreCase("integra")) <br>
name = "acura"; <br>
if (name.equalsIgnoreCase( "acura" )) { <br>
%</strong><strong>> </strong></blockquote>
<a
name=11059></a>
<h4>描述</h4>
<p>一個scriptlet能夠包含多個jsp語句,方法,變量,表達(dá)式 </p>
<p>因為scriptlet,我們便能做以下的事: </p>
<ul>
<a name=16712></a>
<li>聲明將要用到的變量或方法(參考 <a
href="http://www.aspcn.com/syntaxref11.fm3.html#10983">聲明</a>).
<li>編寫JSP表達(dá)式(參考 <a
href="http://www.aspcn.com/syntaxref11.fm4.html#11258">表達(dá)式</a>).
<li>使用任何隱含的對象和任何用<jsp:useBean>聲明過的對象
<li>編寫JSP語句 (如果你在使用Java語言,這些語句必須遵從<em>Java Language Specification,</em>).
<li>任何文本,HTML標(biāo)記,JSP元素必須在scriptlet之外 </li>
</ul>
<p>當(dāng)JSP收到客戶的請求時,scriptlet就會被執(zhí)行,如果scriptlet有顯示的內(nèi)容,這些顯示的內(nèi)容就被存在out對象中。</p>
</td>
</tr>
<tr>
<td>所有文章來自<font color=red>http://www.aspcn.com ASP中華網(wǎng)</font>如要轉(zhuǎn)載請注明出處,謝謝</td>
</tr>
</tbody>
</table>
</BODY></HTML>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -