|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
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 com.bea.wlw.netui.tags.AbstractBaseTag com.bea.wlw.netui.tags.html.FormatTag com.bea.wlw.netui.tags.html.FormatString
public class FormatString
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. |
FormatDate
,
FormatNumber
,
Serialized Form<netui:label value="2125555555"> <netui:formatString pattern="phone (###) ###-####"/> </netui:label>
The <netui:formatString> tag formats the output of its parent tag. For example:
<netui:label value="{pageFlow.phone}"> <netui:formatString pattern="phone number: (###) ###-####"/> </netui:label>
<netui:formatString> uses the following pattern syntax:
The # character is a placeholder for individual characters in the String to be formatted, while other characters are treated as literals. For example:
String "5555555555" with pattern "(###)###-####" would result in: (555)555-5555.
The * character displays all remaining characters in the String. 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.
Nested Class Summary | |
---|---|
static class |
FormatString.StringFormatter
Internal FormatTag.Formatter which performs its own string parsing and formatting. |
Nested classes/interfaces inherited from class com.bea.wlw.netui.tags.html.FormatTag |
---|
FormatTag.Formatter |
Field Summary | |
---|---|
protected boolean |
truncate
Whether or not pattern-exceeding characters should be dropped. |
Fields inherited from class com.bea.wlw.netui.tags.html.FormatTag |
---|
pattern, patternValue |
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag |
---|
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT |
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 com.bea.wlw.netui.tags.html.HtmlConstants |
---|
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH |
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 | |
---|---|
FormatString()
|
Method Summary | |
---|---|
int |
doStartTag()
Create the internal Formatter instance and perform the formatting. |
String |
getTagName()
Return the name of the Tag. |
boolean |
getTruncate()
Gets whether or not pattern-exceeding characters should be dropped. |
protected void |
localRelease()
Release any acquired resources. |
void |
setTruncate(boolean truncate)
Sets whether or not pattern-exceeding characters should be dropped. |
Methods inherited from class com.bea.wlw.netui.tags.html.FormatTag |
---|
getCountry, getLanguage, getLocale, getPattern, setCountry, setLanguage, setPattern |
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
---|
doAfterBody, doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, 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, setParent |
Field Detail |
---|
protected boolean truncate
Constructor Detail |
---|
public FormatString()
Method Detail |
---|
public boolean getTruncate()
public void setTruncate(boolean truncate)
truncate
- - "true" or "false"public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class FormatTag
javax.servlet.jsp.JspException
- if a JSP exception has occurredprotected void localRelease()
localRelease
in class FormatTag
public String getTagName()
getTagName
in class AbstractBaseTag
|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |