|
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.FormatNumber
public class FormatNumber
A formatter used to format numbers. This formatter uses patterns that conform to
java.text.NumberFormat
pattern syntax. FormatNumber calls toString()
on
the object to be formatted to get the value the pattern is applied to.
The valid FormatNumber types are:
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 NumberFormat pattern used to format this number. | |||
type | No | No | No |
The type of the format to apply (number, currency, or percent). |
FormatDate
,
FormatString
,
java.text.NumberFormat
,
Serialized Form<netui:label value="12345678"> <netui:formatNumber pattern="#,###.00" /> </netui:label>
In the next sample, the value ".33" is formatted to 33%.
<netui:label value=".33"> <netui:formatNumber type="percent" /> </netui:label>
In the next sample, the value "14.317" is formatted to $14.32.
<netui:label value="14.317"> <netui:formatNumber country="US" language="en" type="currency" /> </netui:label>
The <netui:formatNumber> tag formats the output of its parent tag. For example:
<netui:label value="{price}"> <netui:formatNumber country="FR" language="fr" type="currency" /> </netui:label>
The pattern
attribute conforms to
java.text.DecimalFormat
pattern syntax.
The pattern
attribute uses the comma as a grouping separater.
If many different grouping sizes are specified in one pattern
,
the right-most grouping interval will be used throughout; the other grouping intervals
will be ignored. For example, the following format patterns all produce the same result.
If the number to format is 123456789, each will produce 123,456,789.
- pattern="#,##,###,###"
- pattern="######,###"
- pattern="##,####,###"
The type
attribute specifies three common
kinds of formatting to be applied to the number.
The valid values for the type
attribute are:
number
currency
percent
The country
attribute takes an upper-case,
two-letter code as defined by ISO-3166.
For a list of country codes see
ISO-3166 Country Codes
The language
attribute takes a lower-case,
two-letter code as defined by ISO-639.
For a list of
ISO-639 language codes see
ISO-639 Language Codes
Nested Class Summary | |
---|---|
static class |
FormatNumber.NumberFormatter
Internal FormatTag.Formatter which uses NumberFormat. |
Nested classes/interfaces inherited from class com.bea.wlw.netui.tags.html.FormatTag |
---|
FormatTag.Formatter |
Field Summary | |
---|---|
protected String |
type
The type of number format to be used. |
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 | |
---|---|
FormatNumber()
|
Method Summary | |
---|---|
int |
doStartTag()
Create the internal Formatter instance and perform the formatting. |
String |
getTagName()
Return the name of the Tag. |
String |
getType()
Gets the type of number format to be used. |
protected void |
localRelease()
Release any acquired resources. |
void |
setType(String type)
Sets the type of number format to be used (number, currency, or percent). |
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 String type
Constructor Detail |
---|
public FormatNumber()
Method Detail |
---|
public String getTagName()
getTagName
in class AbstractBaseTag
public String getType()
public void setType(String type)
type
- - the number format type.number
, currency
, or percent
.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
|
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 |