STRUTS2 tags (take) retain several decimals (2 decimal places reserved, 4 decimal places reserved), date type conversion processing party

Source: Internet
Author: User
Tags i18n reserved

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.