org.apache.taglibs.xtags.xpath
Class ForEachTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.apache.taglibs.xtags.xpath.AbstractBodyTag
              extended byorg.apache.taglibs.xtags.xpath.ForEachTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, ContextNodeTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
ContextTag

public class ForEachTag
extends AbstractBodyTag
implements ContextNodeTag

A tag which performs an iteration over the results of an XPath expression on an XML document

Author:
James Strachan
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
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
ForEachTag()
           
 
Method Summary
 void breakLoop()
          Causes the iteration to be stopped like the Java 'break' statement.
protected  org.dom4j.XPath createXPath(java.lang.String xpathExpression)
          A factory method to create new XPath instances
 int doAfterBody()
           
 int doStartTag()
           
protected  void finishLoop()
          Finishes the loop and outputs the current body
 java.lang.Object getContext()
           
protected  org.dom4j.DocumentFactory getDocumentFactory()
           
 java.lang.String getId()
          Getter for property id.
 java.lang.Object getInputNodes()
           
 java.lang.String getType()
          Getter for property type.
protected  boolean hasNext()
          Performs an iteration and defines a variable of the current object
 boolean isAscending()
          Getter for property ascending.
 boolean isDistinct()
          Getter for property distinct.
 void release()
           
protected  java.util.List selectNodes()
           
 void setAscending(boolean ascending)
          Setter for property ascending.
 void setContext(java.lang.Object context)
           
 void setDistinct(boolean distinct)
          Setter for property distinct.
 void setId(java.lang.String id)
          Setter for property id.
 void setSelect(java.lang.String select)
          Sets the select XPath expression
 void setSelectXPath(org.dom4j.XPath xpath)
          Sets the XPath selection expression
 void setSort(java.lang.String sort)
          Setter for property sort.
 void setSortXPath(org.dom4j.XPath sortXPath)
           
 void setType(java.lang.String type)
          Setter for property type.
 
Methods inherited from class org.apache.taglibs.xtags.xpath.AbstractBodyTag
handleException, logError, logError, logInfo
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, 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
 

Constructor Detail

ForEachTag

public ForEachTag()
Method Detail

breakLoop

public void breakLoop()
               throws javax.servlet.jsp.JspException
Causes the iteration to be stopped like the Java 'break' statement.

Throws:
javax.servlet.jsp.JspException

getContext

public java.lang.Object getContext()
Specified by:
getContext in interface ContextNodeTag
Returns:
the Node or List of nodes which is the context on which XPath expressions will be performed.

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Throws:
javax.servlet.jsp.JspException

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag

setContext

public void setContext(java.lang.Object context)

setSelect

public void setSelect(java.lang.String select)
Sets the select XPath expression


setSelectXPath

public void setSelectXPath(org.dom4j.XPath xpath)
Sets the XPath selection expression


setSort

public void setSort(java.lang.String sort)
Setter for property sort.

Parameters:
sort - New value of property sort.

setSortXPath

public void setSortXPath(org.dom4j.XPath sortXPath)

isDistinct

public boolean isDistinct()
Getter for property distinct.

Returns:
Value of property distinct.

setDistinct

public void setDistinct(boolean distinct)
Setter for property distinct.

Parameters:
distinct - New value of property distinct.

getId

public java.lang.String getId()
Getter for property id.

Returns:
Value of property id.

setId

public void setId(java.lang.String id)
Setter for property id.

Parameters:
id - New value of property id.

getType

public java.lang.String getType()
Getter for property type.

Returns:
Value of property type.

setType

public void setType(java.lang.String type)
Setter for property type.

Parameters:
type - New value of property type.

isAscending

public boolean isAscending()
Getter for property ascending.

Returns:
Value of property ascending.

setAscending

public void setAscending(boolean ascending)
Setter for property ascending.

Parameters:
ascending - New value of property ascending.

selectNodes

protected java.util.List selectNodes()

getInputNodes

public java.lang.Object getInputNodes()
Returns:
the input node on which to make a selction

finishLoop

protected void finishLoop()
                   throws javax.servlet.jsp.JspException
Finishes the loop and outputs the current body

Throws:
javax.servlet.jsp.JspException

hasNext

protected boolean hasNext()
Performs an iteration and defines a variable of the current object


createXPath

protected org.dom4j.XPath createXPath(java.lang.String xpathExpression)
A factory method to create new XPath instances


getDocumentFactory

protected org.dom4j.DocumentFactory getDocumentFactory()
Returns:
the factory used to create XPath instances


Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.