国际化标签 <fmt:bundle>&<fmt:message>的使用
2013-08-26 15:45
381 查看
国际化标签 <fmt:bundle>&<fmt:message>的使用
Message.properties文件:
name=www.gis520.com
#info=欢迎{0}光临!
info=\u6b22\u8fce{0}\u5149\u4e34\uff01
message。jsp文件:
<%@ 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>
运行结果:
也可以是:
Message.properties文件:
name=www.gis520.com
#info=欢迎{0}光临!
info=\u6b22\u8fce{0}\u5149\u4e34\uff01
message。jsp文件:
<%@ 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>
相关文章推荐
- 国际化标签 <fmt:bundle>&<fmt:message>的使用
- 国际化标签 <fmt:bundle>&<fmt:message>的使用
- 关于用<fmt:message>标签读取springmvc配置的国际化资源文件显示为???key???的错误原因
- JSTL标签之<fmt:formatDate/>使用介绍
- 日期格式化标签<fmt:formatDate>&<fmt:setTimeZone>时区标签的使用demo
- 日期格式化标签<fmt:formatDate>&<fmt:setTimeZone>时区标签的使用demo
- 关于HTML <!DOCTYPE> 标签的使用
- Mybatis <collection> 标签使用。
- IE6在<a>标签中使用history.go(-1)返回上一页无效
- 标签&lt;logic:present&gt;的使用 (转)
- <fmt:formatDate>标签
- jsp页显示时间标签JSTL标签 <fmt:formatDate/> 实例大全
- el表达式保留两位小数、使用jstl <fmt:formatNumber>标签保留两位小数
- android_应用开发之(使用<include>标签重用布局)
- <label>标签for属性的使用
- 【Html】使用<pre>标签为你的网页加入大段代码
- <!DOCTYPE> 标签的深度剖析以及使用选择
- <c:forEach>标签与el表达式联合的使用
- HTML5 - Canvas标签<使用>
- Struts2中<s-if>和<s-iterator>标签的使用