subset标签用于去得集合的子集,该标签的底层通过org.apache.struts2.util.Subset.IteratorFilter类提供实现.
使用subset标签可以指定的属性有:
- count: 可选属性,指定子集中元素的个数.在不指定该属性情况下,默认取得源集合的全部元素
- source: 可选属性,指定源集合.若不指定,默认取得ValueStack栈顶的集合.
-
start:可选属性,指定子集从源集合中的第几个元素开始截取.默认从第一个开始截取,默认值为0
- decider:可选属性,指定由开发者自己决定是否选中该元素.
SubsetTagAction.java
@Override
public String execute() throws Exception {
HttpServletRequest request = ServletActionContext.getRequest();
List list_value = new ArrayList();
list_value.add(new Integer(1));
list_value.add(new Integer(2));
list_value.add(new Integer(3));
list_value.add(new Integer(4));
list_value.add(new Integer(5));
Object element = list_value;
System.out.println(((List)element).size()+"ppp");
request.setAttribute("list_values", list_value);
return "subsetTag";
}
public Decider getMyDecider() {
return new Decider() {
public boolean decide(Object element) throws Exception {
int i = ((Integer)element).intValue();
return (((i % 2) == 0)?true:false);
}
};
}
subsetTag.jsp
<s:form>
<s:subset source=" #request.list_values" decider="myDecider">
<s:iterator>
<s:property/>
</s:iterator>
</s:subset>
</s:form>
http://localhost:8080/struts2/subsetTag.action
页面输出:2 4
<s:subset source="#request.list_values" start="1",count="3">
<s:iterator status="st">
</s:iterator>
</s:subset/>
http://localhost:8080/struts2/subsetTag.action
页面输出:2 3 4
分享到:
相关推荐
<%@ taglib prefix="s" uri="/struts-tags" %> 就能使用struts2.0的标签库 下面就介绍每个标签的具体应用实例说明:按字母排列 A: 1. 2. <s:a href=""></s:a>-----超链接,类似于html里的<a></a> 3. <s:...
1.4 Web项目中使用Struts2初探 20 第2章 Web基础技术简介 31 2.1 B/S和C/S系统区别 31 2.2 JSP和Servlet介绍 32 2.3 XML知识介绍 34 第3章 Struts2核心技术 37 3.1 使用web.xml配置Struts2实现Web项目Struts2应用 37...
Please follow the<br>instructions in the top-level Makefile to activate X Window System support.<br><br>Step 2: edit src/mpeg2dec/config.h<br>----------------------------------<br><br>In most cases, ...
<br>Agile Development with ICONIX Process: People, Process, and Pragmatism<br><br>by Doug Rosenberg , Mark Collins-Cope , Matt Stephens <br><br>Publisher: Apress; 1 edition (February 22, 2005)<br><br>...
# The IEEE public OUI listing available from: # ...# This is Wireshark 'manuf' file, which started out as a subset of Michael # Patton's list and grew from there.
将多个集合使用一个<iterator/>标签完成迭代。 generatot标签:将指定的字符串按照规定的分隔符分解成多个子字符串。 merge标签:将多个集合拼接在一起。 subset标签:获取某个集合的子集合。 sort标签:多指定...
9.2 Struts中的国际化支持 185 9.3 text标签 188 9.4 i18n标签 191 9.5 以手动方式选择一个资源包 193 9.6 小结 195 第10章 Model Driven和Preparable拦截器 196 10.1 把动作与模型隔离开 196 10.2 Model ...
2. 主成分分析(ENVI: Transform>>principle compents) Transforms > Principal Components > Forward PC Rotation > Compute New Statistics and Rotate.---- 选择输入文件--- 选择输出 PC 波段数---“Select Subset...
JSP_struts2标签大全 1.a 3 2.action 3 3. actionerror 4 4. actionmessage 5 5. append 5 6. bean 7 7.checkbox 7 8.checkboxlist 8 9. combobox 9 10. conponent 9 11. date 11 12. datetimepicker 12 13. debug ...
实践题1:Sample-Superstore-Subset-Excel.xlsx
9.2 Struts中的国际化支持 185 9.3 text标签 188 9.4 i18n标签 191 9.5 以手动方式选择一个资源包 193 9.6 小结 195 第10章 Model Driven和Preparable拦截器 196 10.1 把动作与模型隔离开 196 10.2 Model Driven...
27<br>vii<br><br> <br>Software Testing and Continuous Quality Improvement<br>2 Overview of Testing Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br>Black-Box Testing (Functional)....
(TreeSet) s.subSet(608, true, 611, true)
本文实例讲述了Python从字典中提取子集的方法。分享给大家供大家参考,具体如下: 问题:想创建一个字典,其本身是另一个字典的子集 解决方案:利用字典推导式(dictionary comprehension)可轻松解决 # example of...
Recently, hybrid CPU/GPU cluster has been widely<br>used to deal with compute-intensive problems, such as the<br>subset-sum problem. The two-list algorithm is a well known<br>approach to solve the ...
Struts2 Result类型,整理的非常详细!
Subset is a library to ease extracting fields from MongoDB documents, serializing them back and constructing queries. 标签:Subset
11.4.1 展示层jsp 2+struts 2标签库实现 711 11.4.2 控制层struts 2实现 720 11.4.3 持久层hibernate 3实现 728 11.4.4 spring 2接管业务逻辑层 730 11.5 小结 733 第12章 站务必备—系统用户管理与流量统计 ...