c标签汇总
来源:互联网 发布:socket文件传输java 编辑:程序博客网 时间:2024/06/06 08:34
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix ="c" %>输出:<c:out value="恭喜发财"></c:out>设置:<c:set var="name" value="韦小宝" scope="page| request| session| application"></c:set> <c:set target="${map}" property="cellphone" value="10010"></c:set>删除:<c:remove var="name" scope="pageContext"/>捕获异常:<c:catch var="e"><%int i = 1/0;%></c:catch>多重选择:<c:choose><c:when test="${day==1}">星期一</c:when><c:when test="${day==2}">星期二</c:when><c:when test="${day==3}">星期三</c:when><c:otherwise>休息日</c:otherwise></c:choose>遍历:<%String[] city = {"北京","上海","广州","铁岭"};pageContext.setAttribute("city",city);%><c:forEach items = "${city}" var = "c">//表示遍历 city 数组,每一项的值用“c”对象保存${c }<br/>//结果:北京 上海 广州 铁岭</c:forEach><% List list = new ArrayList(); list.add("美国"); list.add("中国"); list.add("俄罗斯"); list.add("印度"); pageContext.setAttribute("list", list);%><c:forEach items = "${list}" var = "c"> //表示遍历 list 集合,每一项的值用“c”对象保存 ${c }<br/> //结果:美国 中国 俄罗斯 印度</c:forEach> <h1>遍历map</h1> <% Map map = new HashMap(); map.put("name","曹操"); map.put("age","59"); map.put("wife","小乔"); map.put("gender","男"); pageContext.setAttribute("map", map); %> <c:forEach items = "${map}" var = "entry"> //表示遍历 city 数组,每一项的值用“c”对象保存 ${ entry.key }:${ entry.value }<br/> //结果:wife:小乔 name:曹操 age:59 gender:男 </c:forEach> <h1>遍历10到100的偶数,如果数字所在位置是3的倍数,显示成红色</h1> //varStatus 用来保存遍历状态的 //index 索引 //count 计数值,表示第几个位置的数字 <c:forEach begin = "10" end = "100" step="2" var="i" varStatus="stat"> //从0开始,到10结束,步长为2,变量名为i <c:if test="${stat.count % 3 ==0}"> <font color="red"> ${ i } </font> //结果:0,2,4,6,8,10 </c:if> <c:if test="${stat.count % 3 !=0}"> <font color="blue"> ${ i } </font> //结果:0,2,4,6,8,10 </c:if> </c:forEach>转发: <c:redirect url="/index.jsp" context="${pageContext.request.contextPath}"> //context 中写跳转的web应用名称,url表示跳转到哪个页面 <c:param name="name" value="zhang"/> </c:redirect>获取url地址:<c:url value="/index.jsp" context="${pageContext.request.contextPath}" var="url" scope="page">重定向:<c:redirect url="/index.jsp" context="${pageContext.request.contextPath}"> //context 中写跳转的web应用名称,url表示跳转到哪个页面
0 0
- c标签汇总
- Hibernate配置文件标签汇总
- HTML标签汇总
- JSTL常用标签汇总
- JSTL常用标签汇总
- JSTL 标签汇总
- html meta标签汇总
- jstl标签大汇总
- HTML5所有标签汇总
- jstl标签使用汇总
- MyBatis的标签汇总
- struts2常用标签汇总
- web标签语义汇总
- HTML5所有标签汇总
- 前端头部标签汇总
- html5标签汇总
- HTML5所有标签汇总
- HTML5常用标签汇总
- 随机点名程序.cs
- 各种排序算法的分析及java实现
- J2SE小结
- ae+C#实现图层管理控件上的图层移动功能
- 打开Voice Over时,CATextLayer的string对象兼容NSString和NSAttributedString导致的Crash(一现象)
- c标签汇总
- 从网络解析数据并实现三个界面的跳转
- 找真凶
- 回调函数、消息和事件例程
- UIButton超出UIView边界不可点击,应该怎么办?
- 单层感知器、线性神经网络、几种数据结构算法的学习报告
- C++ Template
- Hdu oj 1061 Rightmost Digit
- ccf 数字排序