©
本文档使用
php中文网手册 发布
<fmt:message>标签映射一个关键字给局部消息,然后执行参数替换。
<fmt:message>标签有如下属性:
| 属性 | 描述 | 是否必要 | 默认值 |
|---|---|---|---|
| key | 要检索的消息关键字 | 否 | Body |
| bundle | 要使用的资源束 | 否 | 默认资源束 |
| var | 存储局部消息的变量名 | 否 | Print to page |
| scope | var属性的作用域 | 否 | 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.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>
运行结果如下:
One Two Three
关于我们 联系我们 留言板
手册网