org.apache.struts2.components
Class AppendIterator

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.ContextBean
          extended by org.apache.struts2.components.AppendIterator
All Implemented Interfaces:
Param.UnnamedParametric

public class AppendIterator
extends ContextBean
implements Param.UnnamedParametric

Component for AppendIteratorTag, which jobs is to append iterators to form an appended iterator whereby entries goes from one iterator to another after each respective iterator is exhausted of entries.

For example, if there are 3 iterator appended (each iterator has 3 entries), the following will be how the appended iterator entries will be arranged:

  1. First Entry of the First Iterator
  2. Second Entry of the First Iterator
  3. Third Entry of the First Iterator
  4. First Entry of the Second Iterator
  5. Second Entry of the Second Iterator
  6. Third Entry of the Second Iterator
  7. First Entry of the Third Iterator
  8. Second Entry of the Third Iterator
  9. Third Entry of the Third ITerator
public class AppendIteratorTagAction extends ActionSupport { private List myList1; private List myList2; private List myList3; public String execute() throws Exception { myList1 = new ArrayList(); myList1.add("1"); myList1.add("2"); myList1.add("3"); myList2 = new ArrayList(); myList2.add("a"); myList2.add("b"); myList2.add("c"); myList3 = new ArrayList(); myList3.add("A"); myList3.add("B"); myList3.add("C"); return "done"; } public List getMyList1() { return myList1; } public List getMyList2() { return myList2; } public List getMyList3() { return myList3; } } <s:append var="myAppendIterator"> <s:param value="%{myList1}" /> <s:param value="%{myList2}" /> <s:param value="%{myList3}" /> </s:append> <s:iterator value="%{#myAppendIterator}"> <s:property /> </s:iterator>

See Also:
AppendIteratorFilter, AppendIteratorTag

Field Summary
 
Fields inherited from class org.apache.struts2.components.ContextBean
var
 
Fields inherited from class org.apache.struts2.components.Component
actionMapper, COMPONENT_STACK, parameters, stack, throwExceptionOnELFailure
 
Constructor Summary
AppendIterator(ValueStack stack)
           
 
Method Summary
 void addParameter(java.lang.Object value)
          Adds the given value as a parameter to the outer tag.
 boolean end(java.io.Writer writer, java.lang.String body)
          Callback for the end tag of this component.
 void setVar(java.lang.String var)
           
 boolean start(java.io.Writer writer)
          Callback for the start tag of this component.
 
Methods inherited from class org.apache.struts2.components.ContextBean
getVar, putInContext, setId
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, altSyntax, completeExpressionIfAltSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, popComponentStack, setActionMapper, setThrowExceptionsOnELFailure, stripExpressionIfAltSyntax, stripExpressionIfAltSyntax, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppendIterator

public AppendIterator(ValueStack stack)
Method Detail

start

public boolean start(java.io.Writer writer)
Description copied from class: Component
Callback for the start tag of this component. Should the body be evaluated?

Overrides:
start in class Component
Parameters:
writer - the output writer.
Returns:
true if the body should be evaluated

end

public boolean end(java.io.Writer writer,
                   java.lang.String body)
Description copied from class: Component
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

Overrides:
end in class Component
Parameters:
writer - the output writer.
body - the rendered body.
Returns:
true if the body should be evaluated again

addParameter

public void addParameter(java.lang.Object value)
Description copied from interface: Param.UnnamedParametric
Adds the given value as a parameter to the outer tag.

Specified by:
addParameter in interface Param.UnnamedParametric
Parameters:
value - the value

setVar

public void setVar(java.lang.String var)
Overrides:
setVar in class ContextBean


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