Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.taglibs.regexp
Class SplitTag  view SplitTag download SplitTag.java

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.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>
 


Field Summary
private  int limit
           
private  java.lang.String regexpid
           
private  java.lang.String textid
           
private  java.lang.String value
           
private  java.util.Iterator values
           
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, 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
SplitTag()
           
 
Method Summary
 int doAfterBody()
          Method called at end of each iteration of the split tag
 int doEndTag()
          Method called at end of split Tag
 int doStartTag()
          Setup to split the text based on supplied attributes
 java.lang.String getSplit()
          String split out from text can be obtained by the JSP page using <jsp:getProperty name="id" property="split"/>
 void setLimit(int limit)
           
 void setRegexp(java.lang.String str)
           
 void setText(java.lang.String str)
           
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, 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
 

Field Detail

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
Constructor Detail

SplitTag

public SplitTag()
Method Detail

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"/>