org.apache.taglibs.string
Class RandomStringTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.apache.taglibs.string.StringTagSupport
              extended byorg.apache.taglibs.string.RandomStringTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class RandomStringTag
extends StringTagSupport

Create a random string. It can create an ascii string, a numeric string, an alphanumeric string, and a unicode string. The size of the string may be specified, as can a start and end character. Lastly, a set of characters to use may be passed in.

count
Number of characters to generate. Required.
start
Start of range of characters to generate from. Linked to type attribute.
end
End of range of characters to generate from. Linked to type attribute.
type
Type of random-string. One of: numeric | alphanumeric | alphabet | unicode. Default value is to unicode.

Author:
bayard@generationjava.com
See Also:
Serialized Form

Field Summary
static java.lang.String ALPHABET
           
static java.lang.String ALPHANUMERIC
           
static java.lang.String NUMERIC
           
static java.lang.String UNICODE
           
 
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
RandomStringTag()
           
 
Method Summary
 java.lang.String changeString(java.lang.String text)
          Perform a transformation on the passed in String.
 java.lang.String getCount()
          Get the count property
 java.lang.String getEnd()
          Get the end property
 java.lang.String getStart()
          Get the start property
 java.lang.String getType()
          Get the type property
 void initAttributes()
          Initialise any properties to default values.
 void setCount(java.lang.String count)
          Set the count property
 void setEnd(java.lang.String end)
          Set the end property
 void setStart(java.lang.String start)
          Set the start property
 void setType(java.lang.String type)
          Set the type property
 
Methods inherited from class org.apache.taglibs.string.StringTagSupport
doEndTag, evaluateString, getVar, setVar
 
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
 

Field Detail

NUMERIC

public static java.lang.String NUMERIC

ALPHANUMERIC

public static java.lang.String ALPHANUMERIC

ALPHABET

public static java.lang.String ALPHABET

UNICODE

public static java.lang.String UNICODE
Constructor Detail

RandomStringTag

public RandomStringTag()
Method Detail

getCount

public java.lang.String getCount()
Get the count property

Returns:
String property

setCount

public void setCount(java.lang.String count)
Set the count property


getStart

public java.lang.String getStart()
Get the start property

Returns:
String property

setStart

public void setStart(java.lang.String start)
Set the start property

Parameters:
start - String property

getEnd

public java.lang.String getEnd()
Get the end property

Returns:
String property

setEnd

public void setEnd(java.lang.String end)
Set the end property

Parameters:
end - String property

getType

public java.lang.String getType()
Get the type property

Returns:
String property

setType

public void setType(java.lang.String type)
Set the type property


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.