org.opensubsystems.core.www
Class StringLimitTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by org.opensubsystems.core.www.StringLimitTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class StringLimitTag
extends javax.servlet.jsp.tagext.BodyTagSupport

Custom tag to intelligently limit the length of a text to certain length. If the length of the string needs to be limited, it will be cut if possible on a word boundary and a ... will be appended to the end.

Version:
$Id: StringLimitTag.java,v 1.6 2007/01/07 06:14:08 bastafidli Exp $
Author:
Miro Halas
See Also:
Serialized Form
Code reviewer:
Miro Halas
Code reviewed:
1.3 2006/02/17 06:54:09 bastafidli

Field Summary
protected  java.lang.String m_strLimit
          Number representing the length to limit the text present in the body of the tag to.
 
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
StringLimitTag()
          Constructor for custom tag.
 
Method Summary
 int doEndTag()
          
 int doStartTag()
          
 java.lang.String getLimit()
           
 void setLimit(java.lang.String strLimit)
           
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, 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

m_strLimit

protected java.lang.String m_strLimit
Number representing the length to limit the text present in the body of the tag to.

Constructor Detail

StringLimitTag

public StringLimitTag()
Constructor for custom tag.

Method Detail

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Throws:
javax.servlet.jsp.JspException

getLimit

public java.lang.String getLimit()
Returns:
String - numeric limit representing length to limit the body text

setLimit

public void setLimit(java.lang.String strLimit)
Parameters:
strLimit - - numeric limit representing length to limit the body text to


Copyright © 2003 - 2006 OpenSubsystems s.r.o.