小白教程
所有教程
关于
Search
172.70.131.182
172.70.131.182
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Jstl format message tag”的源代码
本页内容
上一节:
Jstl_format_settimezone_tag
下一节:
Jstl_format_requestencoding_tag
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:<fmt:message>}}[[Category:jsp jstl|24]] = <fmt:message> 标签 = [[jsp jstl|JSP 标准标签库]] <fmt:message>标签映射一个关键字给局部消息,然后执行参数替换。 === 语法格式 === <sample title="" desc="" lang="jsp" hererun="1"> <fmt:message key="<string>" bundle="<string>" var="<string>" scope="<string>"/> </sample> === 属性 === <fmt:message>标签有如下属性: {| class="table table-striped table-hover" ! '''属性''' ! '''描述''' ! '''是否必要''' ! '''默认值''' |- | key | 要检索的消息关键字 | 否 | Body |- | bundle | 要使用的资源束 | 否 | 默认资源束 |- | var | 存储局部消息的变量名 | 否 | Print to page |- | scope | var属性的作用域 | 否 | Page |} == 实例演示 == <sample title="" desc="" lang="jsp" hererun="1"> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ 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 标签</title> </head> <body> <fmt:setLocale value="en"/> <fmt:setBundle basename="com.xiaobai.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> </sample> 运行结果如下: <sample title="" desc="" lang="jsp" hererun="1"> One Two Three </sample> [[jsp jstl|JSP 标准标签库]]
返回至“
Jstl format message tag
”。
上一节:
Jstl_format_settimezone_tag
下一节:
Jstl_format_requestencoding_tag