Latest web development tutorials

<FMT : setBundle> 태그

JSP 표준 태그 라이브러리 JSP 표준 태그 라이브러리

<FMT : setBundle> 태그는, 자원 번들을로드라는 변수 범위에 저장 또는 구성 변수를 함께 제공하는 데 사용됩니다.

구문

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

재산

<FMT : setBundle> 태그는 다음과 같은 특성이 있습니다 :

재산 기술 필요한 경우 디폴트 값
기본 이름 가족 자원 번들의 기본 이름, 변수 범위 또는 구성 변수에 노출 그것은 인 아니
VAR 새 리소스 번들을 저장하는 변수 아니 기본 교체
범위 변수 범위 아니 페이지


예를 들면 데모

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

결과는 다음과 같습니다 :

One 
Two 
Three

JSP 표준 태그 라이브러리 JSP 표준 태그 라이브러리