两个name要相同,在里边内容为空的时候才会全显示。
<logic:notEmpty name="listcate">
<logic:iterate id="element" name="listcate" scope="request">
<c:set value="0" var="flag"></c:set>
<c:forTokens var="aToken" items="${listid}" delims=",">
<c:if test="${ aToken == element.id }">
<c:set value="1" var="flag"></c:set>
</c:if>
</c:forTokens>
<c:if test="${ flag == '1' }">
<option value="${element.id}" selected="selected">${element.categoryName}</option></c:if>
</logic:iterate>
</logic:notEmpty>
delims,截取字符。
<c:forTokens>标签用于遍历字符串中用特定分隔符分隔的子字符串,并且能重复执行标签主体。<c:forTokens>标签的基本语法如下:
- <c:forEach var="代表子字符串的命名变量的名字" items="被分隔的字符串" delims="分隔符" >
- 标签主体
- </c:forEach>
例如以下代码能遍历字符串"Tom:Mike:Linda"中用分隔符":"分隔的子字符串:
- <c:forTokens var="name" items="Tom:Mike:Linda" delims=":">
- ${name}
- </c:forTokens>
以上代码的打印结果为"Tom Mike Linda"。
在<c:forTokens>标签中也可以使用varStatus、begin、end和step属性,它们的作用和<c:forEach>标签中的相应属性相同。
相关推荐
◎ JSTL的基本概念、安装与配置 ◎ JSTL的通用标记:<c:out>、<c:set>、<c:remove>和<c:catch>标记 ◎ 条件处理标记:<c:if>、<c:choose>、<c:when>和<c:otherwise>标记...◎ 循环标记:<c:forEach>和<c:forTokens>标记
</tr><br> </c:forEach><br> </table><br> <p><br> <li>循环控制标签:c:fortoken</li><br><br> <c:forTokens items="${tokenstr}" delims="," var="v"><br> <c:out value="${v}"/><br> </c:forTokens> <br> <p><br> ...
?Jstl介绍?...用于分隔字符的 <c:forTokens>?标签? 用于包含页面的 <c:import> 用于得到 URL?地址的 <c:url>?标签? 用于页面重定向的 <c:redirect>?标签? 用于包含传递参数的?<c:param> 标签?.
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、读取资源...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、读取资源...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、读取资源...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、...
13.3.8、<c:forTokens>标签 13.3.9、<c:import>标签 13.3.10、<c:url>标签 13.3.11、<c:redirect>标签 13.4、国际化标签库 13.4.1、<fmt:setLocale>标签 13.4.2、<fmt:requestEncoding>标签 13.4.3、读取资源...
EL表达式 (详解) EL表达式 1、EL简介 1)语法结构 ${expression} 2)[]与.... EL 提供.... 当要存取的属性名称中包含一些特殊...=或ne、<或lt、>或gt、<=或le、>=或ge 3.逻辑运算符有三个:&&或and、||或or、!或not ...
1.关键字:JSTL标签、<c:choose>、<c:forEach>、<c:forTokens>、<c:if>、<c:import>、<c:otherwise>、<c:out>、<c:param>、<c:redirect>、<c:remove>、<c:url>、<c:when>、<c:set>、<c:catch>
JSTL标签总结-<c:if>,<c:choose>,<c:forEach>,<c:forTokens>,<c:catch>,<c:remove >,<c:set>,<c:import>,<c:redirect>,<c:url>,<fmt>
JSTL 以及自定义标签开发相关 JSTL 核心标签库标签共有13个,功能上分为4类: 1.表达式控制标签:out、set、remove、catch ...<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
1.表达式控制标签:out、set、remove、catch 2.流程控制标签:if、choose、when、otherwise 3.循环标签:forEach、forTokens 4.URL操作标签:import、url、redirec
04_Java标签库 使用来: 演示如何使用普通 Java JSP Scriptlet <% ... %> & JSP 表达式<%... 测试条件( if和choose )、迭代( forEach和forTokens )和<c>标签 使用测试<c>标签
c:forEach and c:forTokens Tags Section 9.4. c:if Tag Section 9.5. c:choose Tag Section 9.6. c:set and c:remove Tags Section 9.7. c:import Tag Section 9.8. c:url and c:param Tags Section 9.9. c:...
c:forEach and c:forTokens Tags Section 9.4. c:if Tag Section 9.5. c:choose Tag Section 9.6. c:set and c:remove Tags Section 9.7. c:import Tag Section 9.8. c:url and c:param Tags Section 9.9. c:...
1.EL简介 2.EL隐含对象 3.其他隐含对象 4.条件标签 5.迭代标签ForEach 6.分割循环标签ForTokens 7.格式化标签FMT 8.常用逻辑运算符