public class Number extends ContextBean
The number tag will allow you to format a Number in a quick and easy way, based on the java.text.NumberFormat class. There are four basic number types, a number, a currency, a percentage and an integer. If a currency is specified, the number format will match the given currency. Further parameters can be overridden as needed.
If a type is not defined, it will finally fall back to the default NumberFormat.getNumberInstance() formatting. Note: If the requested Number object isn't found on the stack, a blank will be returned. Configurable attributes are :-<!-- START SNIPPET: example --> <s:number name="invoice.total" type="currency" currency="XYZ" /> <s:number name="invoice.quantity" type="number" /> <s:number name="invoice.discount" type="percentage" /> <s:number name="invoice.terms" type="integer" /> <!-- END SNIPPET: example -->
Number
Modifier and Type | Field and Description |
---|---|
static String |
NUMBERTAG_PROPERTY
Property name to fall back when no format is specified
|
var
actionMapper, COMPONENT_STACK, devMode, parameters, stack, standardAttributesMap, throwExceptionOnELFailure
Constructor and Description |
---|
Number(ValueStack stack) |
Modifier and Type | Method and Description |
---|---|
boolean |
end(Writer writer,
String body)
Callback for the end tag of this component.
|
String |
getCurrency() |
Integer |
getMaximumFractionDigits() |
Integer |
getMaximumIntegerDigits() |
Integer |
getMinimumFractionDigits() |
Integer |
getMinimumIntegerDigits() |
String |
getName() |
String |
getRoundingMode() |
String |
getType() |
Boolean |
isGroupingUsed() |
Boolean |
isParseIntegerOnly() |
void |
setCurrency(String currency) |
void |
setGroupingUsed(Boolean groupingUsed) |
void |
setMaximumFractionDigits(Integer maximumFractionDigits) |
void |
setMaximumIntegerDigits(Integer maximumIntegerDigits) |
void |
setMinimumFractionDigits(Integer minimumFractionDigits) |
void |
setMinimumIntegerDigits(Integer minimumIntegerDigits) |
void |
setName(String name) |
void |
setParseIntegerOnly(Boolean parseIntegerOnly) |
void |
setRoundingMode(String roundingMode) |
void |
setType(String type) |
getVar, putInContext, setId, setVar
addAllParameters, addParameter, altSyntax, completeExpressionIfAltSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, getStandardAttributes, isValidTagAttribute, popComponentStack, setActionMapper, setDevMode, setThrowExceptionsOnELFailure, setUrlHelper, start, stripExpressionIfAltSyntax, toString, usesBody
public static final String NUMBERTAG_PROPERTY
public Number(ValueStack stack)
public boolean end(Writer writer, String body)
Component
public void setType(String type)
public void setCurrency(String currency)
public String getName()
public void setName(String name)
public String getType()
public String getCurrency()
public void setGroupingUsed(Boolean groupingUsed)
public Boolean isGroupingUsed()
public Integer getMaximumFractionDigits()
public void setMaximumFractionDigits(Integer maximumFractionDigits)
maximumFractionDigits
- the maximumFractionDigits to setpublic Integer getMaximumIntegerDigits()
public void setMaximumIntegerDigits(Integer maximumIntegerDigits)
maximumIntegerDigits
- the maximumIntegerDigits to setpublic Integer getMinimumFractionDigits()
public void setMinimumFractionDigits(Integer minimumFractionDigits)
minimumFractionDigits
- the minimumFractionDigits to setpublic Integer getMinimumIntegerDigits()
public void setMinimumIntegerDigits(Integer minimumIntegerDigits)
minimumIntegerDigits
- the minimumIntegerDigits to setpublic Boolean isParseIntegerOnly()
public void setParseIntegerOnly(Boolean parseIntegerOnly)
parseIntegerOnly
- the parseIntegerOnly to setpublic String getRoundingMode()
public void setRoundingMode(String roundingMode)
roundingMode
- the roundingMode to setCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.