国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JSP > 正文

JSP 國際化-格式化貨幣和日期

2024-09-05 00:19:47
字體:
來源:轉載
供稿:網友
國內最大的酷站演示中心!

1.格式化貨幣

世界上許多國家都有不同的貨幣格式和數字格式慣例。針對特定的本地化環(huán)境正確地格式化和顯示貨幣是本地化的一個重要部分。

<%@ page pageencoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>currency formatting</title>
</head>
<body>
<h1>currency formatting and locales</h1>
<h3>english, great britain</h3>
<fmt:setlocale value="en_gb" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>english, usa</h3>
<fmt:setlocale value="en_us" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>french, france</h3>
<fmt:setlocale value="fr_fr" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>japanese, japan</h3>
<fmt:setlocale value="ja_jp" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>korean, korea</h3>
<fmt:setlocale value="ko_kr" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>spanish, spain</h3>
<fmt:setlocale value="es_es" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>arabic, egypt</h3>
<fmt:setlocale value="ar_eg" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<h3>using local numeric formatting for different currency</h3>
<h4>english, great britan</h4>
<fmt:setlocale value="en_gb" />
<fmt:formatnumber type="currency" value="80000" /><br/>
<fmt:formatnumber type="currency" value="80000" currencycode="eur"/><br/>
</body>
</html>

2.格式化日期

類似于數字和貨幣格式化,本地化環(huán)境還會影響生成日期和時間的方式。

<%@ page pageencoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>date formatting</title>
</head>
<body>
<h1>date formatting and locale</h1>
<fmt:timezone value="est">
<jsp:usebean id="currenttime" class="java.util.date"/>
<h3>english, great britain</h3>
<fmt:setlocale value="en_gb" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
<h3>english, usa</h3>
<fmt:setlocale value="en_us" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
<h3>french, france</h3>
<fmt:setlocale value="fr_fr" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
<h3>japanese, japan</h3>
<fmt:setlocale value="ja_jp" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
<h3>korean, korea</h3>
<fmt:setlocale value="ko_kr" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
<h3>spanish, spain</h3>
<fmt:setlocale value="es_es" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
<h3>arabic, egypt</h3>
<fmt:setlocale value="ar_eg" />
<fmt:formatdate type="both" datestyle="full" timestyle="full" value="${currenttime}" /><br/>
</fmt:timezone>
</body>
</html>

<fmt:formatdate>動作的屬性
type: 可以是time,date或both。控制是否只生成時間,只生成日期,或者時間日期都生成。
datestyle: 可以是short, medium, long 或 full(default)。控制打印日期使用的具體格式。
timestyle: 可以是short, medium, long 或 full(default)。控制打印時間使用的具體格式。
value: 這是一個java.util.date 類型的值,用于生成日期和時間。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 巴楚县| 徐闻县| 宜昌市| 晋城| 甘孜| 普安县| 双城市| 金昌市| 新沂市| 大兴区| 新沂市| 五寨县| 巴彦淖尔市| 灌云县| 汶上县| 越西县| 云南省| 惠来县| 乐陵市| 潮州市| 慈利县| 沅江市| 临夏市| 新平| 三原县| 神农架林区| 通海县| 江源县| 九江县| 奉节县| 卢龙县| 龙岩市| 德兴市| 台前县| 宝丰县| 平乡县| 璧山县| 突泉县| 获嘉县| 峨山| 行唐县|