|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
jp.terasoluna.fw.web.taglib.DecimalTag
public class DecimalTag
Implementation class of decimal
tag.
Formats and outputs the encoded and decimal value or defines it as
scripting variable.
The numerical data to be formatted supports java.math.BigDecimal
type or java.lang.String
type.
In case of java.lang.String
type, the string should be parsable by the
BigDecimal
constructor.
If it cannot be parsed by BigDecimal
constructor,
NumberFormatException
is thrown.
In DecimalTag
, following attributes are supported.
Attribute name | Default value | Required | Execution time format | Overview |
id |
None | false |
false |
It is specified when the formatted string is to be set to scripting variable and
not to be output to the response.
In case when the formatted string is set to scripting variable,
irrespective of whether the filter attribute is specified or not,
the special HTML characters are not escaped.
|
filter |
true |
false |
true |
Specify whether to escape the special HTML characters at the time of outputting the formatted string.
When id attribute is specified, it is ignored.
|
ignore |
false |
false |
true |
Specify whether to ignore when the bean, which is specified in name attribute, is
not found.If false is specified, JspException is thrown when bean is not found.
|
name |
None | false |
true |
bean name that contains the string to be formatted specified in the property attribute.
When property attribute is not specified,the instance specified in
name attribute needs to be formatted. In this case, that instance itself
should either belong to java.math.BigDecimal type or
java.lang.String type. (It can be parsed by BigDecimal constructor
after deleting the blank space at the right side)
When value attribute is specified, it is ignored.
|
property |
None | false |
true |
Property name which is accessed in bean which is specified in
name attribute. When value attribute is specified, it is ignored.
|
scope |
(Search order of findAttribute() method) |
false |
true |
Scope to search the bean which is specified in
name attribute.
|
value |
None | false |
true |
String to be formatted. It should be possible to parse the string
by the BigDecimal constructor after deleting the white space on the
right side. When value attribute is specified, name
and property attributes are ignored.
|
pattern |
None | true |
true |
Output format. Output format which is specified in
pattern attribute is parsed as pattern of DecimalFormat
class. For details, refer to the documents of DecimalFormat class.
|
scale |
None | false |
true |
Number of decimal places after rounding off.
When n is specified, it is rounded off to n + 1 decimal place.
Round mode is specified in round attribute. When round attribute
is not specified, ROUND_HALF_UP(round off) operation is performed by default.
|
round |
None | false |
true |
Round mode. It becomes valid when scale attribute
is sepcified.ROUND_HALF_UP (round off) and
ROUND_FLOOR (truncate), ROUND_CEILING
(round-up)can be set. ROUND_HALF_UP
is executed by default.When other than the above three settings are specified,
IllegalArgumentException is thrown.
|
In DecimalTag
, following variables are supported.
Variable name | Type | Valid range | Description |
Name which is specified in id attribute of custom tag. |
String |
After start tag | Variable name in case when formatted string is output to a scripting variable and not output in this custom tag. |
Field Summary | |
---|---|
protected boolean |
filter
Check whether to filter special HTML characters when they are output. Default is true . |
protected java.lang.String |
id
Name of scipting variable which can be used on the respective page. |
protected boolean |
ignore
Check whether to ignore (nothing is output) when bean is not found. Throws exception when it is not to be ignored. Default is false .
(Throw exception). |
private static org.apache.commons.logging.Log |
log
Log class. |
protected java.lang.String |
name
bean name that includes the data to be formatted. |
protected java.lang.String |
pattern
Pattern that specifies the output format. It should be same as DecimalFormat . |
protected java.lang.String |
property
Property name which is accessed in the specified bean. |
protected java.lang.String |
round
Round mode. |
protected int |
scale
Number of decimal places after rounding off. When n is specified,
it is rounded off to n + 1 decimal place. |
protected java.lang.String |
scope
Scope to search the specified bean. |
private static long |
serialVersionUID
Serial version ID |
protected java.lang.String |
value
Value to be formatted(string). |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
pageContext |
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 | |
---|---|
DecimalTag()
|
Method Summary | |
---|---|
int |
doStartTag()
Method which is called at the time of starting tag evaluation. |
boolean |
getFilter()
Get the filter to decide whether the special HTML characters are to be filtered. |
java.lang.String |
getId()
Fetches the name of scripting variable. |
boolean |
getIgnore()
Getignore method to decide whether to ignore when the bean is not found. |
java.lang.String |
getName()
Fetches the name of bean that includes the data to be formatted. |
java.lang.String |
getPattern()
Fetches the pattern that specifies the output format. |
java.lang.String |
getProperty()
Fetches the name of property which is accessed in specified bean. |
java.lang.String |
getRound()
Fetches the round mode. |
int |
getScale()
Fetches the number of decimal places after rounding off. |
java.lang.String |
getScope()
Fetches the scope to search the specified bean. |
java.lang.String |
getValue()
Fetches the value to be formatted. |
void |
release()
Releases all allocated resources. |
void |
setFilter(boolean filter)
setFilter method to decide whether the special HTML characters are to be filtered. |
void |
setId(java.lang.String id)
Sets the name of scripting variable. |
void |
setIgnore(boolean ignore)
setIgnore method to decide whether to ignore when the bean is not found. |
void |
setName(java.lang.String name)
Sets the name of bean that includes the data to be formatted. |
void |
setPattern(java.lang.String pattern)
Sets the pattern that specifies the output format. |
void |
setProperty(java.lang.String property)
Sets the name of property which is accessed in the specified bean. |
void |
setRound(java.lang.String round)
Sets the round mode. |
void |
setScale(int scale)
Sets the number of decimal places after rounding off. |
void |
setScope(java.lang.String scope)
Sets the scope to search the specified bean. |
void |
setValue(java.lang.String value)
Sets the value to be formatted. |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, doEndTag, findAncestorWithClass, getParent, getValue, getValues, removeValue, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private static org.apache.commons.logging.Log log
protected java.lang.String id
protected boolean filter
true
.
protected boolean ignore
false
(Throw an exception).
protected java.lang.String name
protected java.lang.String property
protected java.lang.String scope
protected java.lang.String pattern
DecimalFormat
.
protected java.lang.String value
protected int scale
n
is specified,it is rounded off
to n + 1
decimal place.
protected java.lang.String round
Constructor Detail |
---|
public DecimalTag()
Method Detail |
---|
public java.lang.String getId()
getId
in class javax.servlet.jsp.tagext.TagSupport
public void setId(java.lang.String id)
setId
in class javax.servlet.jsp.tagext.TagSupport
id
- Name of scripting variablepublic boolean getFilter()
true
public void setFilter(boolean filter)
filter
- When the special HTML characters are to be filtered, it is true
public boolean getIgnore()
true
public void setIgnore(boolean ignore)
ignore
- When it is to be ignored, it is true
public java.lang.String getName()
public void setName(java.lang.String name)
name
- bean namepublic java.lang.String getProperty()
public void setProperty(java.lang.String property)
property
- Name of property which is accessed in the specified bean.public java.lang.String getScope()
public void setScope(java.lang.String scope)
scope
- Scope to search the specified bean.public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern
- Patternpublic java.lang.String getValue()
public void setValue(java.lang.String value)
value
- Value to be formattedpublic int getScale()
public void setScale(int scale)
scale
- Number od decimal placespublic java.lang.String getRound()
public void setRound(java.lang.String round)
round
- Round modepublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
SKIP_BODY
javax.servlet.jsp.JspException
- JSP exceptionpublic void release()
release
in interface javax.servlet.jsp.tagext.Tag
release
in class javax.servlet.jsp.tagext.TagSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |