public class SortIteratorTag extends StrutsBodyTagSupport
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
}
%>
| Constructor and Description |
|---|
SortIteratorTag() |
| Modifier and Type | Method and Description |
|---|---|
int |
doEndTag() |
int |
doStartTag() |
void |
setComparator(String comparator) |
void |
setSource(String source) |
void |
setVar(String var) |
findString, findValue, findValue, getBody, getStack, toStringdoAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContentfindAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValuepublic void setComparator(String comparator)
public void setSource(String source)
public void setVar(String var)
public int doStartTag()
throws javax.servlet.jsp.JspException
doStartTag in interface javax.servlet.jsp.tagext.TagdoStartTag in class javax.servlet.jsp.tagext.BodyTagSupportjavax.servlet.jsp.JspExceptionpublic int doEndTag()
throws javax.servlet.jsp.JspException
doEndTag in interface javax.servlet.jsp.tagext.TagdoEndTag in class javax.servlet.jsp.tagext.BodyTagSupportjavax.servlet.jsp.JspExceptionCopyright © 2000–2021 Apache Software Foundation. All rights reserved.