可以在資源文件中定義日期及其數字的格式化,例如在classpath下新建一個.properties文件,起名為format.properties,內容如下
format.date = {0,date,dd-MM-yyyy}
{}里面的意思如下
{ 參數序號(從0開始), 格式類形(number | date | time | choice), 格式樣式(詳情請見http://java.sun.com/docs/books/tutorial/i18n/format /decimalFormat.html#numberpattern)}
用<s:text>進行引用
前臺顯示:09-04-2009
在屬性文件中可以進行數字等格式話
format.percent = {0,number,##0.00'%'}
format.money = {0,number,$##0.00}
參見帖子如下:
http://www.aygfsteel.com/keweibo/articles/174997.html
format.date = {0,date,dd-MM-yyyy}
{}里面的意思如下
{ 參數序號(從0開始), 格式類形(number | date | time | choice), 格式樣式(詳情請見http://java.sun.com/docs/books/tutorial/i18n/format /decimalFormat.html#numberpattern)}
用<s:text>進行引用
<s:i18n name="format">
<s:text name="format.date" >
<s:param value="user.birthday"></s:param>
</s:text>
</s:i18n>
后臺如果設置user.setBirthday(new Date());<s:text name="format.date" >
<s:param value="user.birthday"></s:param>
</s:text>
</s:i18n>
前臺顯示:09-04-2009
在屬性文件中可以進行數字等格式話
format.percent = {0,number,##0.00'%'}
format.money = {0,number,$##0.00}
參見帖子如下:
http://www.aygfsteel.com/keweibo/articles/174997.html