Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.views.jsp.iterator
Class SubsetIteratorTag

    java.lang.Object
      javax.servlet.jsp.tagext.TagSupport
          javax.servlet.jsp.tagext.BodyTagSupport
              org.apache.struts2.views.jsp.StrutsBodyTagSupport
                  org.apache.struts2.views.jsp.iterator.SubsetIteratorTag

All Implemented Interfaces:
  Serializable, BodyTag, IterationTag, JspTag, Tag

    public class SubsetIteratorTag

extends StrutsBodyTagSupport

NOTE: JSP-TAG

A tag that takes an iterator and outputs a subset of it. It delegates to `SubsetIteratorFilter` internally to perform the subset functionality.

- count (Object) - Indicate the number of entries to be in the resulting subset iterator
- source* (Object) - Indicate the source of which the resulting subset iterator is to be derived base on
- start (Object) - Indicate the starting index (eg. first entry is 0) of entries in the source to be available as the first entry in the resulting subset iterator
- decider (Object) - Extension to plug-in a decider to determine if that particular entry is to be included in the resulting subset iterator
- id (String) - Indicate the pageContext attribute id to store the resultant subset iterator in

     public class MySubsetTagAction extends ActionSupport {
          public String execute() throws Exception {
             l = new ArrayList();
             l.add(new Integer(1));
             l.add(new Integer(2));
             l.add(new Integer(3));
             l.add(new Integer(4));
             l.add(new Integer(5));
             return "done";
          }

          public Integer[] getMyArray() {
             return a;
          }

          public List getMyList() {
             return l;
           }

          public Decider getMyDecider() {
          return new Decider() {
              public boolean decide(Object element) throws Exception {
                  int i = ((Integer)element).intValue();
                  return (((i % 2) == 0)?true:false);
              }
          };
          }
      }

     <!-- s: List basic -->
        <s:subset source="myList">
           <s:iterator>
              <s:property />
           </s:iterator>
        </s:subset>

     <!-- B: List with count -->
        <s:subset source="myList" count="3">
           <s:iterator>
               <s:property />
           </s:iterator>
         </s:subset>

     <!--  C: List with start -->
          <s:subset source="myList" count="13" start="3">
             <s:iterator>
               <s:property />
             </s:iterator>
          </s:subset>

     <!--  D: List with id -->
          <s:subset id="mySubset" source="myList" count="13" start="3" />
          <%
              Iterator i = (Iterator) pageContext.getAttribute("mySubset");
              while(i.hasNext()) {
          %>
          <%=i.next() %>
          <%  } %>

      <!--  D: List with Decider -->
          <s:subset source="myList" decider="myDecider">
                 <s:iterator>
                      <s:property />
                 </s:iterator>
          </s:subset>

See Also:
  Serialized Form

Field Summary
`private static Log` | `_log`
`(package private) String` | `countAttr`
`(package private) String` | `deciderAttr`
`private static long` | `serialVersionUID`
`(package private) String` | `sourceAttr`
`(package private) String` | `startAttr`
`(package private) SubsetIteratorFilter` | `subsetIteratorFilter`

Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
`bodyContent`

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
`id, pageContext`

Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
`EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
`EVAL_BODY_AGAIN`

Fields inherited from interface javax.servlet.jsp.tagext.Tag
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

Constructor Summary
`SubsetIteratorTag()`

Method Summary
`int` | `doEndTag()`
`int` | `doStartTag()`
`void` | `setCount(String count)`
`void` | `setDecider(String decider)`
`void` | `setSource(String source)`
`void` | `setStart(String start)`

Methods inherited from class org.apache.struts2.views.jsp.StrutsBodyTagSupport
`altSyntax, findString, findValue, findValue, getBody, getStack, setId, toString, translateVariables`

Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
`doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent`

Methods inherited from class javax.servlet.jsp.tagext.TagSupport
`findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.servlet.jsp.tagext.Tag
`getParent, setPageContext, setParent`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

See Also:
  Constant Field Values

### _log

    private static final Log _log

### countAttr

    String countAttr

### sourceAttr

    String sourceAttr

### startAttr

    String startAttr

### deciderAttr

    String deciderAttr

### subsetIteratorFilter

    SubsetIteratorFilter subsetIteratorFilter

Constructor Detail

### SubsetIteratorTag

    public SubsetIteratorTag()

Method Detail

### setCount

    public void setCount(String count)

### setSource

    public void setSource(String source)

### setStart

    public void setStart(String start)

### setDecider

    public void setDecider(String decider)

### doStartTag

    public int doStartTag()
                   throws JspException

  Specified by:
    `doStartTag` in interface `Tag`
  Overrides:
    `doStartTag` in class `BodyTagSupport`
  Throws:
    `JspException`

### doEndTag

    public int doEndTag()
                 throws JspException

  Specified by:
    `doEndTag` in interface `Tag`
  Overrides:
    `doEndTag` in class `BodyTagSupport`
  Throws:
    `JspException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.