发布于 2015-08-17 14:56:20 | 131 次阅读 | 评论: 0 | 来源: 网络整理

<fmt:message>标签映射键到本地化消息和参数进行更换。

属性:

<fmt:message>标签具有以下属性:

属性 描述 必须 默认
key 消息键用来检索 No Body
bundle 资源包使用 No Default bundle
var 变量名称来存储本地化消息 No Print to page
scope 存储本地化消息的变量范围 No Page

例子:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
<title>JSTL fmt:message Tag</title>
</head>
<body>

<fmt:setLocale value="en"/>
<fmt:setBundle basename="com.yiibai.Example" var="lang"/>

<fmt:message key="count.one" bundle="${lang}"/><br/>
<fmt:message key="count.two" bundle="${lang}"/><br/>
<fmt:message key="count.three" bundle="${lang}"/><br/>

</body>
</html>

这将产生以下结果:


One 
Two 
Three
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务