國際化標籤 <fmt:bundle>&<fmt:message>的使用
分類:Java Web
(1449)(0)舉報收藏
name=www.gis520.com
#info=歡迎{0}光臨!
info=\u6b22\u8fce{0}\u5149\u4e34\uff01
<%@ page contentType="text/html" pageEncoding="GBK"%>
<%@ page import="java.util.*"%>
<%@ taglib prefix="fmt" uri="jst/fmt"%>
<html>
<head><title>核心標籤庫</title></head>
<body>
<%
pageContext.setAttribute("date",new Date());
%>
<fmt:bundle basename="Message">
<fmt:message key="name" var="nameref"/>
<h3>name內容爲:${nameref}</h3>
<fmt:message key="info" var="inforef">
<fmt:param value="GIS520"/>
</fmt:message>
<h3>info內容爲:${inforef}</h3>
</fmt:bundle>
</body>
</html>
name內容爲:www.gis520.com
info內容爲:歡迎GIS520光臨!
- <%@ page contentType="text/html" pageEncoding="GBK"%>
- <%@ page import="java.util.*"%>
- <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
- <html>
- <head><title>核心標籤庫</title></head>
- <body>
- <fmt:setBundle basename="Message" var="msg"/>
- <fmt:message key="name" var="nameref" bundle="${msg}"/>
- <h3>name內容爲:${nameref}</h3>
- <fmt:message key="info" var="inforef" bundle="${msg}">
- <fmt:param value="GIS520"/>
- </fmt:message>
- <h3>info內容爲:${inforef}</h3>
- </body>
- </html>
<%@ page contentType="text/html" pageEncoding="GBK"%>
<%@ page import="java.util.*"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head><title>核心標籤庫</title></head>
<body>
<fmt:setBundle basename="Message" var="msg"/>
<fmt:message key="name" var="nameref" bundle="${msg}"/>
<h3>name內容爲:${nameref}</h3>
<fmt:message key="info" var="inforef" bundle="${msg}">
<fmt:param value="GIS520"/>
</fmt:message>
<h3>info內容爲:${inforef}</h3>
</body>
</html>