发布于 2015-08-17 14:43:07 | 106 次阅读 | 评论: 0 | 来源: 网络整理

<fmt:setBundle>标签是用来加载资源包并将其存储在指定的范围变量或包配置变量。

属性:

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

属性 描述 必须 默认
basename 资源包家族公开作用域或配置变量的基本名称 Yes None
var 变量名称用来存储新包 No Replace default
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:setBundle 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号  版权声明  广告服务