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

<fmt:message> 태그

JSP 표준 라벨 라이브러리

<fmt:message> 태그는 지역 메시지에 키를 매핑하고 파라미터 대체를 수행합니다.

문법 형식

<fmt:message
   key="<string>"
   bundle="<string>"
   var="<string>"
   scope="<string>"/>

속성

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

속성설명필수 여부기본 값
key 검색할 메시지 키워드 아니요 Body
bundle 사용할 리소스 백 아니요 기본 리소스 백
var 로컬 메시지를 저장하는 변수 이름 아니요 페이지에 출력
범위 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:message 태그</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 표준 라벨 라이브러리