FormatString Class
- public class FormatString
extends FormatTag
A formatter used to format strings. FormatString uses the following pattern syntax:
The '#' character gets replaced by the next character in the string getting formatted,
while other characters get put in as literals. For example:
String "5555555555" with pattern "(###)###-####" would result in: (555)555-5555.
The '*' character will display all characters in the string at that point in the pattern. For example:
String "123456" with pattern "#-*!" would result in: 1-23456!
If a result with a '#' or '*' character showing is desired, the '#' or '*' needs to
be escaped with the '$' character. For example:
String "ABCD" with pattern "$#-####" would result in: #-ABCD.
To show a '$' in the result, the '$' character needs to be escaped. For example:
String "1234" with pattern "$$#,###" would result in: $1,234
If the truncate attribute is set to "true", characters in the string that exceed the pattern
will be dropped. Otherwise, they will be appended to the end of the formatted string.
Attribute Descriptions |
Attribute | Required | Runtime Expression Evaluation | Data Bindable |
country | No | No | No |
The country code used to determine the locale |
language | No | No | No |
The language code used to determine the locale |
pattern | No | No | Read Only |
The pattern used to format this string |
truncate | No | No | No |
A boolean specifying whether characters that exceed the pattern's length
should be dropped. |
Related Topics
<netui:format...> Tag Samples
FormatDate
FormatNumber
-
Hierarchy
-
Object
TagSupport
BodyTagSupport
AbstractBaseTag
FormatTag
FormatString
-
All Implemented Interfaces
-
BodyTag
, IterationTag
, Serializable
, Tag
protected boolean |
-
truncate
- Whether or not pattern-exceeding characters should be dropped.
|
Fields from com.bea.wlw.netui.tags.AbstractBaseTag |
ATTR_GENERAL , ATTR_GENERAL_EXPRESSION , ATTR_JAVASCRIPT , ATTR_STYLE , CLASS , ID , JAVASCRIPT_STATUS , NAME , NETUI_UNIQUE_CNT , ONCLICK , ONDBLCLICK , ONKEYDOWN , ONKEYPRESS , ONKEYUP , ONMOUSEDOWN , ONMOUSEMOVE , ONMOUSEOUT , ONMOUSEOVER , ONMOUSEUP , STYLE , TABINDEX
|
public int |
-
doStartTag ()
- Create the internal Formatter instance and perform the formatting.
|
public String |
-
getTagName ()
- Return the name of the Tag.
|
public boolean |
-
getTruncate ()
- Gets whether or not pattern-exceeding characters should be dropped.
|
protected void |
-
localRelease ()
- Release any acquired resources.
|
public void |
-
setTruncate (boolean truncate)
- Sets whether or not pattern-exceeding characters should be dropped.
|
Methods from com.bea.wlw.netui.tags.AbstractBaseTag |
addTagIdMapping , evaluateAttributeToString , filter , filter , getJavaScriptUtils , getNearestForm , getScriptReporter , getUserLocale , localRelease , registerTagError , release , renderAttribute , rewriteName , write
|
Methods from javax.servlet.jsp.tagext.TagSupport |
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
truncate
protected boolean truncate
- Whether or not pattern-exceeding characters should be dropped.
FormatString
public FormatString()
doStartTag() Method
public int doStartTag()
throws JspException
Create the internal Formatter instance and perform the formatting.
-
Overrides
-
FormatTag.doStartTag()
Exceptions
-
JspException
- if a JSP exception has occurred
getTagName() Method
public String
getTagName()
Return the name of the Tag.
-
Overrides
-
AbstractBaseTag.getTagName()
getTruncate() Method
public boolean getTruncate()
Gets whether or not pattern-exceeding characters should be dropped.
Returns
- the truncate value ("true" or "false").
localRelease() Method
protected void localRelease()
Release any acquired resources.
-
Overrides
-
FormatTag.localRelease()
setTruncate(boolean) Method
public void setTruncate(boolean truncate)
Sets whether or not pattern-exceeding characters should be dropped.
Parameters
-
truncate
- - "true" or "false"