zoukankan      html  css  js  c++  java
  • subset标签过滤集合元素

        subset标签用于筛选集合里元素。它使用一个Filter,将不合格的元素过滤掉,剩下原集合的一个子集。例如:

     1 <%@ page language="java" contentType="text/html; charset=UTF-8"%>
     2 <%@ taglib uri="/struts-tags" prefix="struts"%>
     3 <%@ taglib uri="/struts-tags" prefix="s"%>
     4 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     5 <html>
     6 <head>
     7 <title>My JSP 'index.jsp' starting page</title>
     8 <meta http-equiv="pragma" content="no-cache">
     9 <meta http-equiv="cache-control" content="no-cache">
    10 <meta http-equiv="expires" content="0">
    11 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    12 <meta http-equiv="description" content="This is my page">
    13 <!--
    14     <link rel="stylesheet" type="text/css" href="styles.css">
    15     -->
    16 
    17 <struts:head theme="ajax" />
    18 
    19 <style type="text/css">
    20 body,td {
    21     font-size: 12px;
    22 }
    23 </style>
    24 </head>
    25 
    26 <body>
    27 
    28 
    29 <h3><font color="#0000FF"> &lt;struts:append /&gt;标签 </font></h3>
    30 
    31 <!-- 可以结合SubsetAction,通过subset.action测试效果 -->
    32 <s:subset source="maleList" decider="decider">    <!-- 筛选标签 -->
    33     <s:iterator>                                  <!-- 遍历筛选后的结果 -->
    34         <s:property />                            <!-- 输出每个遍历的值 -->
    35         <br>
    36     </s:iterator>
    37 </s:subset>
    38 
    39 </body>
    40 </html>

        maleList是Action中的集合属性,decider是Action中的Filter属性。decider必须实现SubsetIteratorFilter接口以及decide()方法。

  • 相关阅读:
    文件上传漏洞之js验证
    文件上传漏洞靶机upload-labs(1到10)
    URI/URL/URN都是什么
    解压jdk报错gzip: stdin: not in gzip format
    burpsuite常见问题
    C/C++字符串反转的N种方法
    转 二叉树之Java实现二叉树基本操作
    MySQL 面试基础
    转 MySQL中的行级锁,表级锁,页级锁
    MySQL问题排查工具介绍
  • 原文地址:https://www.cnblogs.com/Nickzerui/p/4620675.html
Copyright © 2011-2022 走看看