JSTL I18N 格式标签库

<%@ page language="java" pageEncoding="gbk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:useBean id="date" class="java.util.Date"></jsp:useBean>
<html>
    <head>
        <title>I18N标签库</title>
    </head>
    <body>
        <H4>
            <c:out value="<fmt:setlocale>标签的使用"></c:out>
        </H4>
        <hr>
        <fmt:setLocale value="en_us" />
        英文:
        <fmt:formatDate value="${date}" type="both" dateStyle="full"
            timeStyle="full" />
        <hr>
        <fmt:setLocale value="zh_cn" />
        中文:
        <fmt:formatDate value="${date}" type="both" dateStyle="full"
            timeStyle="full" />
        <hr>
        <fmt:setLocale value="zh_TW" />
        中国*:
        <fmt:formatDate value="${date}" type="both" dateStyle="full"
            timeStyle="full" />
    </body>
</html>
<%@ page language="java" pageEncoding="gbk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:useBean id="date" class="java.util.Date"></jsp:useBean>
<html>
    <head>
        <title>I18N标签库</title>
    </head>
    <body>
        <fmt:formatDate value="${date}"></fmt:formatDate>
        <br>
        <fmt:formatDate value="${date}" type="both"></fmt:formatDate>
        <br>
        <fmt:formatDate value="${date}" type="both" dateStyle="default"
            timeStyle="default"></fmt:formatDate>
        <br>
        <fmt:formatDate value="${date}" type="both" dateStyle="short"
            timeStyle="short"></fmt:formatDate>
        <br>
        <fmt:formatDate value="${date}" type="both" dateStyle="long"
            timeStyle="long"></fmt:formatDate>
        <br>
        <fmt:formatDate value="${date}" type="both" dateStyle="full"
            timeStyle="full"></fmt:formatDate>
        <br>
        <fmt:formatDate value="${date}" type="both" dateStyle="full"
            timeStyle="full"></fmt:formatDate>
        <br>
    </body>
</html>

本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/1537253

上一篇:【Unity3D】Unity3D开发《我的世界》之六、创建地形(视频 + 源码)


下一篇:《剑指offer》— JavaScript(1)二维数组中的查找