The subset tag is used to filter elements in the collection. It uses a filter to filter out unqualified elements, leaving a subset of the original set. For example:
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 <Metahttp-equiv= "Pragma"content= "No-cache">9 <Metahttp-equiv= "Cache-control"content= "No-cache">Ten <Metahttp-equiv= "Expires"content= "0"> One <Metahttp-equiv= "keywords"content= "Keyword1,keyword2,keyword3"> A <Metahttp-equiv= "description"content= "This is my page"> - <!-- - <link rel= "stylesheet" type= "Text/css " href= "Styles.css" > the - - - <Struts:headTheme= "Ajax" /> - + <styletype= "Text/css"> - BODY,TD{ + font-size:12px; A } at </style> - </Head> - - <Body> - - in <H3><FontColor= "#0000FF"> <Struts:append/>Label</Font></H3> - to <!--can be combined with subsetaction, through subset.action test effect - + <S:subsetSource= "Malelist"decider= "Decider"> <!--Filter Labels - - <S:iterator> <!--Traverse Filtered Results - the <S:property/> <!--output values for each traversal - * <BR> $ </S:iterator>Panax Notoginseng </S:subset> - the </Body> + </HTML>
Malelist is the collection property in action, and decider is the Filter property in action. The decider must implement the Subsetiteratorfilter interface and the decide () method.
Subset Tag Filter collection elements