文字
分享

<fmt:setBundle> 标签


<fmt:setBundle>标签用来载入一个资源束,然后将它存储在作用域中已命名的变量或bundle配置变量中。


属性

<fmt:setBundle>标签有如下属性:

属性 描述 是否必要 默认值
basename 资源束家族基础名称,暴露给作用域变量或配置变量
var 存储新资源束的变量 Replace default
scope 变量的作用域 Page

实例演示

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

<%@ 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.tutorialspoint.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>

运行结果如下:

1

2

3

One

Two

Three

关于我们 联系我们 留言板

手册网