""> "" />
Easy Tutorial
❮ Jstl Core If Tag Jsp Xml Data ❯

<fmt:message> Tag

JSP Standard Tag Library

The <fmt:message> tag maps a key to a localized message and performs parameter substitution.

Syntax

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

Attributes

The <fmt:message> tag has the following attributes:

Attribute Description Required Default Value
key The message key to retrieve No Body
bundle The resource bundle to use No Default resource bundle
var The variable name to store the localized message No Print to page
scope The scope of the var attribute No Page

Example Demonstration

<%@ 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 Tag</title>
</head>
<body>

<fmt:setLocale value="en"/>
<fmt:setBundle basename="com.tutorialpro.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>

The output is as follows:

One 
Two 
Three

JSP Standard Tag Library

❮ Jstl Core If Tag Jsp Xml Data ❯