Article from: Struts2 tags (take) keep several decimals (keep 2 decimal places, keep 4 decimal places), date type conversion processor Add the following configuration in the internationalization configuration file Struts2
#保留两位小数
global.format.number = {0,number,###,## #0. xx}
#两位小数加%
global.format.percent = {0,number,# #0.00 }%
Global.format.money = {0,number,$# #0. xx}
global.format.date = {0,DATE,YYYY-MM-DD}
Global.format.time = {0,date,hh:mm:ss}
global.format.datetime = {0,date,yyyy-mm-dd HH:mm:ss}
#保留三位小数
Global.format.number3 = {0,number,###,## #0.}
#保留四位小数
global.format.number4 = {0,number,###,## #0.0000}
Configuration
Introduction of configuration files in Struts.xml:
<constant name= "struts.custom.i18n.resources" value= "config"/>
Or introduce the configuration in struts.properties:
struts.custom.i18n.resources = Config
Page Call
<s:text name= "Global.format.number" ><s:param value= "portfolio.others"/></s:text>
<s: Text name= "Global.format.date" ><s:param value= "date" ></s:param></s:text>
Note:
A special label is provided for the processing of dates STRUTS2:
<s:date name= "Collectday" format= "Yyyy-mm-dd"/>
' Collectday ' is a Date object, ' Yyyy-mm-dd ' is converted into a format