<Fmt: messaggio> tag
<Fmt: messaggio> tag per mappare una chiave per le notizie locali, e quindi eseguire i parametri di sostituzione.
sintassi
<fmt:message key="<string>" bundle="<string>" var="<string>" scope="<string>"/>
proprietà
<Fmt: messaggio> tag ha i seguenti attributi:
proprietà | descrizione | Se necessario | difetto |
---|---|---|---|
chiave | Per recuperare la chiave del messaggio | no | corpo |
impacchettare | Per utilizzare il pacchetto di risorse | no | Il pacchetto di risorse di default |
var | Nome variabile memorizza notizie locali | no | Stampa la pagina |
portata | attributo var Scope | no | pagina |
Esempi Demo
<%@ 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.w3big.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>
I risultati sono i seguenti:
One Two Three