org.apache.taglibs.string
Class TruncateNicelyTag
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.tagext.BodyTagSupport
org.apache.taglibs.string.StringTagSupport
org.apache.taglibs.string.TruncateNicelyTag
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag
public class TruncateNicelyTag
- extends StringTagSupport
A more intelligent substring. It attempts to cut off a string after
a space, following predefined or user-supplied lower and upper limits,
useful for making short descriptions from long text. Can also strip
HTML, or if not, intelligently close any tags that were left open.
It adds on a user-defined ending.
- lower
-
Minimum length to truncate at.
Required.
- upper
-
Maximum length to truncate at.
Required.
- upper
-
String to append to end of truncated string.
- Author:
- timster@mac.com
- See Also:
- Serialized Form
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 |
Method Summary |
java.lang.String |
changeString(java.lang.String text)
Perform a transformation on the passed in String. |
java.lang.String |
getAppendToEnd()
|
java.lang.String |
getLower()
Get the lower property |
java.lang.String |
getUpper()
Get the upper property |
void |
initAttributes()
Initialise any properties to default values. |
void |
setAppendToEnd(java.lang.String s)
|
void |
setLower(java.lang.String l)
Set the upper property |
void |
setUpper(java.lang.String u)
Set the upper property |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doAfterBody, 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 |
TruncateNicelyTag
public TruncateNicelyTag()
getLower
public java.lang.String getLower()
- Get the lower property
- Returns:
- String lower property
setLower
public void setLower(java.lang.String l)
- Set the upper property
- Parameters:
lower
- String property
getUpper
public java.lang.String getUpper()
- Get the upper property
- Returns:
- String upper property
setUpper
public void setUpper(java.lang.String u)
- Set the upper property
- Parameters:
upper
- String property
getAppendToEnd
public java.lang.String getAppendToEnd()
setAppendToEnd
public void setAppendToEnd(java.lang.String s)
changeString
public java.lang.String changeString(java.lang.String text)
throws javax.servlet.jsp.JspException
- Description copied from class:
StringTagSupport
- Perform a transformation on the passed in String.
- Specified by:
changeString
in class StringTagSupport
- Parameters:
text
- String to be manipulated
- Returns:
- String result of operation upon passed in String
- Throws:
javax.servlet.jsp.JspException
initAttributes
public void initAttributes()
- Description copied from class:
StringTagSupport
- Initialise any properties to default values.
This method is called upon construction, and
after changeString(String) is called.
This is a default empty implementation.
- Overrides:
initAttributes
in class StringTagSupport
Copyright ? 2000-2004 The Apache Software Foundation. All Rights Reserved.