Package org.zkoss.web.servlet.dsp.action

## Class ForEach

- java.lang.Object
- - org.zkoss.web.servlet.dsp.action.AbstractAction
  - - org.zkoss.web.servlet.dsp.action.ForEach

- All Implemented Interfaces:
    `Action`

      public class ForEach
      extends AbstractAction

  Iterators thru a collection/array of items.
  Author:
    tomyeh

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ForEach()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getBegin()` | Returns the index of the item at which the iteration begins.
    `int` | `getEnd()` | Returns the index of the item at which the iteration ends (inclusive).
    `java.lang.Object` | `getItems()` | Returns the attribute items.
    `java.lang.String` | `getVar()` | Returns the variable name used to iterate thru items.
    `java.lang.String` | `getVarStatus()` | Returns the variable name used to hold the current iteration status, an instance of `LoopStatus`.
    `boolean` | `isTrim()` | Returns whether to trim the result.
    `void` | `render​(ActionContext ac, boolean nested)` | Processes the action and renders the output to `ActionContext.getOut()`.
    `void` | `setBegin​(int beg)` | Sets the index of the item at which the iteration begins.
    `void` | `setEnd​(int end)` | Sets the index of the item at which the iteration ends (inclusive).
    `void` | `setItems​(java.lang.Object items)` | Sets the attribute items.
    `void` | `setTrim​(boolean trim)` | Sets whether to trim the result.
    `void` | `setVar​(java.lang.String var)` | Sets the variable name used to iterate thru items.
    `void` | `setVarStatus​(java.lang.String varStatus)` | Sets the variable name used to hold the current iteration status.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class org.zkoss.web.servlet.dsp.action.AbstractAction

      `append, append, append, getIf, getUnless, isEffective, setIf, setUnless, toScope`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ForEach

          public ForEach()

  - ### Method Detail

    - #### getVar

          public java.lang.String getVar()

      Returns the variable name used to iterate thru items.

    - #### setVar

          public void setVar​(java.lang.String var)

      Sets the variable name used to iterate thru items.

    - #### getVarStatus

          public java.lang.String getVarStatus()

      Returns the variable name used to hold the current iteration status, an instance of `LoopStatus`.

    - #### setVarStatus

          public void setVarStatus​(java.lang.String varStatus)

      Sets the variable name used to hold the current iteration status.

    - #### getItems

          public java.lang.Object getItems()

      Returns the attribute items.

    - #### setItems

          public void setItems​(java.lang.Object items)

      Sets the attribute items.

    - #### getBegin

          public int getBegin()

      Returns the index of the item at which the iteration begins.

    - #### setBegin

          public void setBegin​(int beg)

      Sets the index of the item at which the iteration begins.

      Default: 0.

    - #### getEnd

          public int getEnd()

      Returns the index of the item at which the iteration ends (inclusive).

    - #### setEnd

          public void setEnd​(int end)

      Sets the index of the item at which the iteration ends (inclusive).

      Default: Integer.MAX_VALUE.

    - #### isTrim

          public boolean isTrim()

      Returns whether to trim the result.

    - #### setTrim

          public void setTrim​(boolean trim)

      Sets whether to trim the result.

      Default: true.

    - #### render

          public void render​(ActionContext ac,
                             boolean nested)
                      throws DspException,
                             java.io.IOException

      Description copied from interface: `Action`
      Processes the action and renders the output to `ActionContext.getOut()`.
        `nested` - whether there is any nested content.
      Throws:
        `DspException`
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`