Save This Page
Home » struts-2.1.8.1-src » org.apache » struts2 » views » jsp » iterator » [javadoc | source]
org.apache.struts2.views.jsp.iterator
public class: SortIteratorTag [javadoc | source]
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.SortIteratorTag

All Implemented Interfaces:
    BodyTag, IterationTag, Serializable

NOTE: JSP-TAG

A Tag that sorts a List using a Comparator both passed in as the tag attribute. If 'var' attribute is specified, the sorted list will be placed into the PageContext attribute using the key specified by 'var'. The sorted list will ALWAYS be pushed into the stack and poped at the end of this tag.



USAGE 1:
<s:sort comparator="myComparator" source="myList">
     <s:iterator>
     <!-- do something with each sorted elements -->
     <s:property value="..." />
     </s:iterator>
</s:sort>

USAGE 2:
<s:sort var="mySortedList" comparator="myComparator" source="myList" />

<%
   Iterator sortedIterator = (Iterator) pageContext.getAttribute("mySortedList");
   for (Iterator i = sortedIterator; i.hasNext(); ) {
     // do something with each of the sorted elements
   }
%>


Field Summary
 String comparatorAttr     
 String sourceAttr     
 String var     
 SortIteratorFilter sortIteratorFilter     
Fields inherited from javax.servlet.jsp.tagext.BodyTagSupport:
bodyContent
Fields inherited from javax.servlet.jsp.tagext.TagSupport:
id,  pageContext,  class$javax$servlet$jsp$tagext$Tag
Method from org.apache.struts2.views.jsp.iterator.SortIteratorTag Summary:
doEndTag,   doStartTag,   setComparator,   setId,   setSource,   setVar
Methods from org.apache.struts2.views.jsp.StrutsBodyTagSupport:
findString,   findValue,   findValue,   getBody,   getStack,   toString
Methods from javax.servlet.jsp.tagext.BodyTagSupport:
doAfterBody,   doEndTag,   doInitBody,   doStartTag,   getBodyContent,   getPreviousOut,   release,   setBodyContent
Methods from javax.servlet.jsp.tagext.TagSupport:
class$,   doAfterBody,   doEndTag,   doStartTag,   findAncestorWithClass,   getId,   getParent,   getValue,   getValues,   release,   removeValue,   setId,   setPageContext,   setParent,   setValue
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.views.jsp.iterator.SortIteratorTag Detail:
 public int doEndTag() throws JspException 
 public int doStartTag() throws JspException 
 public  void setComparator(String comparator) 
 public  void setId(String string) 
 public  void setSource(String source) 
 public  void setVar(String var)