Jsp-jstl-format-message-tag
提供:Dev Guides
JSTL-コア<fmt:message>タグ
*<fmt:message>* タグは、キーをローカライズされたメッセージにマップし、パラメトリック置換を実行します。
属性
*<fmt:message>* タグには次の属性があります-
Attribute | Description | Required | Default |
---|---|---|---|
key | Message key to retrieve | No | Body |
bundle | Resource bundle to use | No | Default bundle |
var | Name of the variable to store the localized message | No | Print to page |
scope | Scope of the variable to store the localized message | 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.finddevguides.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