java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.regexp.SplitTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
- public class SplitTag
- extends javax.servlet.jsp.tagext.BodyTagSupport
JSP Tag split, used to implement a perl style
split on the text.
The body of the tag iterates through each string generated
from the split. The normal <jsp:getProperty/> can be
used to get the value of each string split out using the
id of the split tag script variable.
The attribute text must be set to the id of a
text tag.
By default, the split is done on whitespace. Set the
optional attribute regexp to the id of a regexp
tag script variable id to perform the split using a custom
regular expression.
You can set the optional tag attribute limit to the
number of items you want to limit the split to.
JSP Tag Lib Descriptor
<name>split</name>
<tagclass>org.apache.taglibs.regexp.SplitTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>Implements a perl style split on the text.</info>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>text</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>regexp</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<attribute>
<name>limit</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
regexpid
private java.lang.String regexpid
textid
private java.lang.String textid
limit
private int limit
values
private java.util.Iterator values
value
private java.lang.String value
SplitTag
public SplitTag()
doStartTag
public final int doStartTag()
throws javax.servlet.jsp.JspException
- Setup to split the text based on supplied attributes
doAfterBody
public final int doAfterBody()
throws javax.servlet.jsp.JspException
- Method called at end of each iteration of the split tag
doEndTag
public final int doEndTag()
throws javax.servlet.jsp.JspException
- Method called at end of split Tag
setRegexp
public final void setRegexp(java.lang.String str)
setText
public final void setText(java.lang.String str)
setLimit
public final void setLimit(int limit)
getSplit
public final java.lang.String getSplit()
- String split out from text can be obtained by the JSP page
using <jsp:getProperty name="id" property="split"/>