<Fmt: setBundle> tag
<Fmt: setBundle> tag viene utilizzato per caricare un bundle di risorse, quindi conservarlo in un ambito variabile chiamata o raggruppare le variabili di configurazione.
sintassi
<fmt:setBundle baseName="<string>" var="<string>" scope="<string>"/>
proprietà
<Fmt: setBundle> tag ha i seguenti attributi:
proprietà | descrizione | Se necessario | difetto |
---|---|---|---|
basename | Cognome risorsa fascio di base, esposto alla portata o configurazione delle variabili variabili | è | no |
var | Variabile per memorizzare il nuovo pacchetto di risorse | no | Sostituire predefinita |
portata | portata variabile | 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:setBundle 标签</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