English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

<fmt:setBundle> 태그

JSP 표준 태그 라이브러리

<fmt:setBundle> 태그는 리소스 백스를 로드하고, 그것을 스코프에서 이름 지정된 변수나 백스 구성 변수에 저장하는 데 사용됩니다.

문법 형식

<fmt:setBundle baseName="<string>" var="<string>" scope="<string>"/>

속성

<fmt:setBundle> 태그는 다음 속성을 가집니다:

속성 설명 필수 여부 기본 값
basename 리소스 백스 가족 기본 이름으로, 스코프 변수나 구성 변수에 노출됩니다 없음
var 새로운 리소스 백스를 저장하는 변수 아니요 기본 설정을 대체하십시오
범위 변수의 범위 아니요 Page

예제 보여주기

<%@ 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.w3codebox.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

JSP 표준 태그 라이브러리