国际化标签 <fmt:bundle>&<fmt:message>的使用
国际化标签 <fmt:bundle>&<fmt:message>的使用
name=www.gis520.commessage。jsp文件:
#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>
<%@ 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>