<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">The <i><b><;fmt:setBundle>;</b></i> tag is used to load a resource bundle and stores it in the named scoped variable or the bundle configuration variable.</p>
<p><i><b><;fmt:setBundle>;</b></i> tag in JSTL is used in a JSP page to set the resource bundle. A resource bundle is loaded by this tag and is stored into the named scoped variable or the bundle configuration variable.</p>
<p><b>Attributes of <i><;fmt:setBundle>;</i></b></p>
<ul style="text-align: left;">
<li>basename : This is a required attribute used for specifying the base name of resource bundle . Basename is a resource name, follows the same component separator dot (.) as the package uses for specifying the fully qualified class name. It does not uses the any type of suffixes such as .properties, .class etc.</li>
<li>var : This is an optional attribute used for specifying the name of the exported base name to a variable.</li>
<li>scope : This is an optional attribute is used for specifying the scope of the variable.</li>
</ul>
<p>
<b>Example-</b><br />
An example is being given here will demonstrate you how to use the <i><b><;fmt:setBundle>;</b></i> tag. In this example I have created a Properties file named<i><b> myapp.properties</b></i> that contains the key-value pair. Value of key are the English characters. Then created a JSP page named index.jsp into which I have set the locale using the <b><i><;fmt:setLocale>;</i></b> tag. And then uses the <i><b><;fmt:setBundle>;</b></i> tag to load the bundle resource from the resource variable. So as an output you will see the values written in English language. </p>
<pre class="highlight" name="code"><;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>;
<;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>;
<;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">;
<;html>;
<;head>;
<;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">;
<;title>;JSTL fmt:setBundle Tag<;/title>;
<;/head>;
<;body>;
<;fmt:setBundle basename="myapp" var="lang"/>;
<;fmt:setLocale value="en"/>;
<;fmt:message key="Name" bundle="${lang}"/>;<;br/>;
<;fmt:message key="Address" bundle="${lang}"/>;<;br/>;
<;fmt:message key="Number" bundle="${lang}"/>;<;br/>;
<;/body>;
<;/html>;
</pre>
<p>
myapp.properties</p>
<pre class="highlight" name="code">Name=Dinesh
Address=Noida
Number=9988998899
</pre>
<p>
Output :</p>
<p>When the execution process will be completed successfully an output will be displayed on your eclipse browser as :</p>
<div class="separator" style="clear: both; text-align: center;"><img border="0" src="http://50.87.249.200/~dineshon/wp-content/uploads/2013/10/333-4.png" /></div>
<p>
</div>
<p></p>
<div style="background-color: pink; border-width: thin; text-align: center;"><b><;<;<a href="https://dineshonjava.com/2013/10/jstl-set-locale-example.html">Previous</a> <;<; ; ; || <a href="https://dineshonjava.com/2013/10/jsp-standard-tag-library-jstl-tutorial.html">Index </a>||  ; >;>;<a href="https://dineshonjava.com/2013/10/jstl-timezone-settimezone-fmt-tag.html">Next</a> >;>;</b></div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/jstl-set-locale-example/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/jstl-timezone-settimezone-fmt-tag/">Next</a> 
									 </div> 
									</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
 $.post('https://dineshonjava.com/wp-admin/admin-ajax.php', {action: 'mts_view_count', id: '302'});
});
</script>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…