</td>
<td width="267">
</td>
</tr>
</table>
二、计算x的平方
<table>
<tr><th>Value</th>
<th>Square</th></tr>
<tr><td>
<td>
</table>
三、字符串"47,52,53,55,46,22,16,2" 分隔.
<table border="1">
<tr><td>
</table>
四、使用步长
<table>
<tr><th>second</th>
<th>second</th></tr>
<tr><td>
<td>
</table>
五、对数组进行循环
<% int ai[] = {10, 20, 30, 40, 50};
pageContext.setAttribute("ary", ai);
%>
<%
Cookie c=new Cookie("cookie1","one");
response.addCookie(c);
%>
<%
Cookie cookies[]=request.getCookies();
Cookie sCookie=null;
String sname=null;
String name=null;
if(cookies==null) // 如果没有任何cookie
out.print("none any cookie");
else
{
//out.print(cookies.length + "
");
for(int i=0;i
sCookie=cookies[i];
sname=sCookie.getName();
name = sCookie.getValue();
out.println(sname + "->" + name + "
");
}
}
%>
<table border="1" align="center">
<tr><th>Cookie Name</th>
<th>Cookie Value</th></tr>
<tr><td>
<td>
</table>
六、字符串数组循环
<% String as[] = {
"A first string", "La deuxieme string", "Ella troisiemo stringo"
};
request.setAttribute("stringArray", as);
%>
七、枚举
<%
Hashtable hashtable1 = new Hashtable();
pageContext.setAttribute("numberMap", hashtable1);
hashtable1.put(new Integer(1), "uno");
hashtable1.put(new Integer(2), "dos");
hashtable1.put(new Integer(3), "tres");
hashtable1.put(new Integer(4), "cuatro");
hashtable1.put(new Integer(5), "cinco");
hashtable1.put(new Integer(6), "seis");
hashtable1.put(new Integer(7), "siete");
hashtable1.put(new Integer(8), "ocho");
hashtable1.put(new Integer(9), "nueve");
hashtable1.put(new Integer(10), "diez");
java.util.Enumeration enumeration = hashtable1.keys();
pageContext.setAttribute("enumeration", enumeration);
%>
八、map
</body>
↑返回目录
前一篇: 使用EL、JSTL处理表单数据
后一篇: Lucene倒排索引原理