<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">In this tutorial you will learn about how to use the JSTL fmt tag <i><b>setLocale </b></i>in JSP.</p>
<p> JSTL Set Locale Tag is used to change the locale configuration. SetLocal tag takes ISO Language Code and ISO Country Code as a value. By default it is set to en_US.</p>
<p> <i><b>setLocale </b></i>tag sets the specified locale provided in its attribute &#8216;<b>value</b>&#8216;. This tag keeps the specified locale in the configuration variable of locale.</p>
<p> <b>Attributes of <i><;fmt:setLocale>;</i>:</b></p>
<ul style="text-align: left;">
<li><b>value </b>: This is a required attribute and used for specifying a locale. To specify a locale code it must have made from the two-letter (lower case) language code (according to ISO-639) and/or the two-letter (upper-case) of country code (according to the ISO-3166). And if both the language and country code are used for specifying the locale the locale code must be separated by either hyphen (-) or underscore (_).</li>
<li><b>variant </b>: This attribute is used for specifying the browser or vendor specific variant.</li>
<li><b>scope </b>: This attribute specifies the scope of locale configuration variable.</li>
</ul>
<p><b>Example :</b></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:bundle Tag<;/title>;
<;/head>;
<;body>;
<;!-- Setting Locale to US -->;
 <;fmt:setLocale value="en_US"/>;
 <;fmt:formatNumber value="0.452" type="CURRENCY" minFractionDigits="3">;<;/fmt:formatNumber>;
 <;br/>;
 <;!-- Setting Locale to UK -->;
 <;fmt:setLocale value="en_GB"/>;
 <;fmt:formatNumber value="0.452" type="CURRENCY" minFractionDigits="3">;<;/fmt:formatNumber>;
 <;br/>;
 <;!-- Setting Locale to India -->;
 <;fmt:setLocale value="en_IN"/>;
 <;fmt:formatNumber value="0.452" type="CURRENCY" minFractionDigits="3">;<;/fmt:formatNumber>;
<;br/>;
<;fmt:setLocale value="en"/>;
<;fmt:bundle basename="myapp">;
<;fmt:message key="Name"/>;<;br/>;
<;fmt:message key="Address"/>;<;br/>;
<;fmt:message key="Number"/>;<;br/>;
<;/fmt:bundle>;
<;/body>;
<;/html>;
</pre>
<p></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-5.png" /></div>
<p> As you can see above, currency symbols is displayed based on setting of locale variable.</p>
</div>
<div style="background-color: pink; border-width: thin; text-align: center;"><b><;<;<a href="https://dineshonjava.com/2013/10/jstl-bundle-tag.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-fmt-tag-setbundle-example.html">Next</a> >;>;</b></div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/jstl-bundle-tag/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/jstl-fmt-tag-setbundle-example/">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: '303'});
});
</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…