国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 通州市| 郴州市| 陇南市| 洱源县| 佛坪县| 竹北市| 大新县| 江门市| 凉山| 涞源县| 吉林市| 金坛市| 枞阳县| 嘉荫县| 牡丹江市| 凤山市| 静乐县| 临漳县| 衡南县| 林甸县| 甘孜县| 昌平区| 伊吾县| 温宿县| 台南市| 深圳市| 华阴市| 平顶山市| 葫芦岛市| 宜章县| 泰安市| 通江县| 抚顺市| 宁城县| 章丘市| 长宁县| 罗田县| 敖汉旗| 新竹县| 法库县| 新竹县|