|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.jsp.tagext.TagSupport | +--javax.servlet.jsp.tagext.BodyTagSupport | +--javawebparts.taglib.basicstr.SubstrTag
This class is a custom tag that returns a portion of a string. This
function can work in a number of ways, defined by setting the following
attributes:
type - This is the type of substring to get. Valid values are "mid",
"left" and "right". Required: Yes.
count - This attribute is required when type is "left" or "right". It is
the number of characters from the left or right of the source string,
depending on what type is, that will be returned. If this value is <= 0
then nothing will returned. If this value is > the length of the source
string then the entire source string will be returned.
Required: Yes, if type is "left" or "right".
start - This attribute is required when type is "mid". It is the 1-based
character the substring begins at, inclusive. In other words, the first
character of the string is 1, so a value of 1 will start with the first
character. If this value is less than 1 or is greater than the length of
the source string, the value 1 will be used. Required: Yes, if type
is "mid".
end - This attribute is required when type is "mid". It is the 1-based
character the substring ends at, inclusive. If this value is less than 1 or
is greater than the length of the source string, the length of the string
will be user. Required: Yes, if type is "mid".
Note that in all cases if an attribute is unparsable as a number either
because it is not present or has a non-parsable value, this tag will
return nothing.
Field Summary | |
private java.lang.String |
count
Number of characters to return when doing "left" or "right" type. |
private java.lang.String |
end
End of substring when type is "mid". |
private static org.apache.commons.logging.Log |
log
Log instance. |
private java.lang.String |
start
Start of substring when type is "mid". |
private java.lang.String |
text
This is the body content text to be altered. |
private java.lang.String |
type
This is the trim type attribute. |
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 | |
SubstrTag()
|
Method Summary | |
int |
doAfterBody()
Alter the body content. |
int |
doEndTag()
Render the altered body. |
void |
setCount(java.lang.String inCount)
count mutator. |
void |
setEnd(java.lang.String inEnd)
end mutator. |
void |
setStart(java.lang.String inStart)
start mutator. |
void |
setType(java.lang.String inType)
type mutator. |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doInitBody, doStartTag, 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 |
private static org.apache.commons.logging.Log log
private java.lang.String text
private java.lang.String type
private java.lang.String count
private java.lang.String start
private java.lang.String end
Constructor Detail |
public SubstrTag()
Method Detail |
public void setType(java.lang.String inType)
inType
- Trim type.public void setCount(java.lang.String inCount)
inCount
- count.public void setStart(java.lang.String inStart)
inStart
- start.public void setEnd(java.lang.String inEnd)
inEnd
- end.public int doAfterBody() throws javax.servlet.jsp.JspException
doAfterBody
in interface javax.servlet.jsp.tagext.IterationTag
doAfterBody
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- If anything goes wrong.public int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
in interface javax.servlet.jsp.tagext.Tag
doEndTag
in class javax.servlet.jsp.tagext.BodyTagSupport
javax.servlet.jsp.JspException
- If anything goes wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |