- 浏览: 326783 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
y_715:
document.getElementById("e ...
JSTL EC TABLE extremeTable 学习 -
wangyj0898:
学习了。。。
display table 标签用法 -
hejiajie2008:
没有图啊
图解myeclipse把maven普通java项目变成web项目的全程操作 -
zhangyu_2100:
[align=center][/align][color=br ...
request.getRealPath()的替代方法 -
senhui19:
LZ写的真不错呀,现在开发中都经常是用DetachedCrit ...
Hibernate的Criteria用法总结
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>JSTL测试1--c:forEach循环</title>
</head>
<body>
一、整数
<c:forEach var="i" begin="1" end="10" step="1">
<c:out value="" />,
</c:forEach><p>
二、计算x的平方
<table>
<tr><th>Value</th>
<th>Square</th></tr>
<c:forEach var="x" begin="0" end="10" step="2">
<tr><td><c:out value=""/></td>
<td><c:out value="0"/></td></tr>
</c:forEach>
</table> <p>
三、字符串"47,52,53,55,46,22,16,2" 分隔.
<table border="1">
<c:forTokens items="47,52,53,55,46,22,16,2" delims="," var="dailyPrice">
<tr><td><c:out value=""/></td></tr>
</c:forTokens>
</table><p>
四、使用步长
<table>
<tr><th>second</th>
<th>second</th></tr>
<c:forEach var="seconds" begin="0" end="1800" step="60">
<tr><td><c:out value=""/></td>
<td><c:out value=""/></td></tr>
</c:forEach>
</table> <p>
五、对数组进行循环<p>
<% int ai[] = {10, 20, 30, 40, 50};
pageContext.setAttribute("ary", ai);
%>
<c:forEach var="i" items="">
<c:out value=""/>*
</c:forEach><p>
<%
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 + "<br>");
for(int i=0;i<cookies.length; i++) // 循环列出所有可用的Cookie
{
sCookie=cookies[i];
sname=sCookie.getName();
name = sCookie.getValue();
out.println(sname + "->" + name + "<br>");
}
}
%>
<table border="1" align="center">
<tr><th>Cookie Name</th>
<th>Cookie Value</th></tr>
<c:forEach var="cook" items="">
<tr><td><c:out value=""/></td>
<td><c:out value=""/></td></tr>
</c:forEach>
</table> <p>
六、字符串数组循环
<% String as[] = {
"A first string", "La deuxieme string", "Ella troisiemo stringo"
};
request.setAttribute("stringArray", as);
%><p>
<c:forEach var="string" items="">
<c:out value=""/><br>
</c:forEach>
七、枚举
<%
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);
%>
<c:forEach var="item" items="" begin="2" end="10" step="2">
<c:out value=""/><br>
</c:forEach><p>
八、map<p>
<c:forEach var="prop" items="" begin="1" end="5">
<c:out value=""/> = <c:out value=""/><br>
</c:forEach>
</body>
</html>
<%@ page import="java.util.*" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>JSTL测试1--c:forEach循环</title>
</head>
<body>
一、整数
<c:forEach var="i" begin="1" end="10" step="1">
<c:out value="" />,
</c:forEach><p>
二、计算x的平方
<table>
<tr><th>Value</th>
<th>Square</th></tr>
<c:forEach var="x" begin="0" end="10" step="2">
<tr><td><c:out value=""/></td>
<td><c:out value="0"/></td></tr>
</c:forEach>
</table> <p>
三、字符串"47,52,53,55,46,22,16,2" 分隔.
<table border="1">
<c:forTokens items="47,52,53,55,46,22,16,2" delims="," var="dailyPrice">
<tr><td><c:out value=""/></td></tr>
</c:forTokens>
</table><p>
四、使用步长
<table>
<tr><th>second</th>
<th>second</th></tr>
<c:forEach var="seconds" begin="0" end="1800" step="60">
<tr><td><c:out value=""/></td>
<td><c:out value=""/></td></tr>
</c:forEach>
</table> <p>
五、对数组进行循环<p>
<% int ai[] = {10, 20, 30, 40, 50};
pageContext.setAttribute("ary", ai);
%>
<c:forEach var="i" items="">
<c:out value=""/>*
</c:forEach><p>
<%
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 + "<br>");
for(int i=0;i<cookies.length; i++) // 循环列出所有可用的Cookie
{
sCookie=cookies[i];
sname=sCookie.getName();
name = sCookie.getValue();
out.println(sname + "->" + name + "<br>");
}
}
%>
<table border="1" align="center">
<tr><th>Cookie Name</th>
<th>Cookie Value</th></tr>
<c:forEach var="cook" items="">
<tr><td><c:out value=""/></td>
<td><c:out value=""/></td></tr>
</c:forEach>
</table> <p>
六、字符串数组循环
<% String as[] = {
"A first string", "La deuxieme string", "Ella troisiemo stringo"
};
request.setAttribute("stringArray", as);
%><p>
<c:forEach var="string" items="">
<c:out value=""/><br>
</c:forEach>
七、枚举
<%
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);
%>
<c:forEach var="item" items="" begin="2" end="10" step="2">
<c:out value=""/><br>
</c:forEach><p>
八、map<p>
<c:forEach var="prop" items="" begin="1" end="5">
<c:out value=""/> = <c:out value=""/><br>
</c:forEach>
</body>
</html>
发表评论
-
java.lang.NoClassDefFoundError: javax/el/ELException
2010-09-06 01:07 2562在maven中配置以下依赖: <depe ... -
配置过滤器
2009-12-28 12:04 1083配置过滤器,通过mapping ... -
关于div的隐藏
2009-12-28 12:01 1023div的visibility可以控制div的显示和隐藏,但是隐 ... -
request.getRealPath()的替代方法
2009-08-25 15:26 2827替代方法是: 写道 request.getSession( ... -
JSP注释详解(新手必看)
2009-07-03 14:14 1399在客户端显示一个注释. JSP 语法<!-- comme ... -
把JSP放到WEB-INF后以保护JSP源代码
2008-12-15 10:58 1571本人在看《J2EE核心模式》(“Core J2ee Patte ... -
struts配置文件中<forward>标签的redirect属性
2008-12-02 20:47 2354struts-config.xml中有这样 ... -
STRUTS中ec标签的用法
2008-11-25 16:41 24761.<ec:table items="pres ... -
JSP生成彩色验证码
2008-06-28 09:47 1213程序代码image.jsp<%@ page conten ... -
对表单输入的数据做校验
2008-05-23 20:11 1188对表单输入的数据做校验 在struts中带有了Jakarta ... -
活学活用 Struts (转)
2008-04-11 16:02 14861.概述 Struts大家都很熟悉,不再详细介绍,另 ... -
newValue
2008-03-17 13:14 1356public List getAllList(String x ... -
web开发设计displaytag应用指南
2008-03-10 15:26 1457DisplayTag是一个非常好用的表格显示标签,适合MVC模 ... -
display table 标签用法
2008-03-10 15:25 5633在web.xml下添加一个filter <filte ... -
JSTL1.1函数标签库(functions)如fn:length
2008-03-10 15:02 14359在jstl中的fn标签也是我 ... -
JSP Struts之HTML标签库详解
2008-03-10 15:00 1848Struts提供了五个标签库,即:HTML、Bean、Logi ... -
web.xml详解
2008-03-10 14:51 5479web.xml元素介绍 每一个站的WEB-INF下都有一个we ... -
Struts配置文件详解(3)
2008-03-10 14:50 1234<?xml version="1.0" ... -
Struts配置文件详解(2)
2008-03-10 14:49 1775关于 Struts中 struts-config.xml文件的 ... -
Struts配置文件详解(1)
2008-03-10 14:49 1257Struts应用采用两个基于X ...
相关推荐
为循环控制,它可以将集合(Collection)中的成员循序浏览一遍。运作方式为当条件符合时,就会持续重复执行<c:forEach>的本体内容。 语法 语法1:迭代一集合对象之所有成员 <c:forEach [var="varName"] items=...
JSTL 以及自定义标签...3.循环标签:forEach、forTokens 4.URL操作标签:import、url、redirect 使用标签时,一定要在jsp文件头加入以下代码: <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
用于循环的 <c:forEach>?标签 用于分隔字符的 <c:forTokens>?标签? 用于包含页面的 用于得到 URL?地址的 <c:url>?标签? 用于页面重定向的 <c:redirect>?标签? 用于包含传递参数的?<c:param> 标签?.
</table><br> <p><br> 循环控制标签:c:fortoken</li><br> ${tokenstr}" delims="," var="v"> ${v}"/> </c:forTokens> <p><br> 循环控制标签:c:foreach-map</li><br> <c:forEach items="${map}...
1.表达式控制标签:out、set、remove、catch 2.流程控制标签:if、choose、when、otherwise 3.循环标签:forEach、forTokens 4.URL操作标签:import、url、redirec
◎ JSTL的基本概念、安装与配置 ◎ JSTL的通用标记:、、和标记 ◎ 条件处理标记:、、和标记 ◎ 循环标记:<c:forEach>和标记
-- 循环查找记录 --> <c:forEach var="row" items="${rs.rows}" begin="${currentPage*PerPageNum}" end="${PerPageNum+currentPage*PerPageNum-1}" > <td> ${row.id } <td> ${row.image}" width=...
3.使用JSTL的<c:forEach>标签取代Category.isp和Produetjsp中的for循环语句。 (1)参考教材完成使用JSTL的<c:forEach>标签取代Category.jsp的for循环语句。 (2)自已完成使用JSTL的<c:forEach>标签取代Productjsp中的...
13 、 <c:forEach> 循环 14、<c:forEach> varStatus 的四种属性 15、<c:forEach> 的用法 16、从客户端传送数据至服务端 17、使用Unicode转义字符 18、使用朝鲜语字符集 19、JSP中最简单的国际化程序 20、错误检测 21...
取得请求的URL,但不包括请求之参数字符串 ${pageContext.request.contextPath} 服务的web application 的名称 ${pageContext.request.method} 取得HTTP 的方法(GET、POST) ${pageContext.request.protocol}...
我们定义两个jsp main.jsp userlist.jsp main.jsp 右侧有个div id=’userlist’ 层,负责接受通过传递过来的userlist.jsp userlist 处理列表数据 for循环 jstl foreach 标签都可以 main.jsp 点击用户列表按钮触发...
13 、 <c:forEach> 循环 14、<c:forEach> varStatus 的四种属性 15、<c:forEach> 的用法 16、从客户端传送数据至服务端 17、使用Unicode转义字符 18、使用朝鲜语字符集 19、JSP中最简单的国际化程序 20、错误检测 21...
2) 将JSP页面中的静态数据 修改为从数据库查询到的动态数据,通过JSTL的ForEach进行循环遍历数据,并通过EL表达式取出数据。 3) 修改JSP代码中的分页查询部分代码, 并将(总记录条数,总页码数,每页要显示的数据...