Locale Display in a JSP : I18N « JSP « Java






Locale Display in a JSP

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head><title>Locale Display</title></head>
<body>
<h2>Here is your preferred locale info...</h2>

<c:set var="clientLocale" value="${pageContext.request.locale}" />
<c:set var="clientLocales" value="${pageContext.request.locales}" />

Preferred locale: ${clientLocale.displayName}
 <br />
Preferred locale country: ${clientLocale.displayCountry}
<br />
Preferred locale language: ${clientLocale.displayLanguage}
<h3>Lower priority locales...</h3>
<c:forEach var="loc" items="${clientLocales}" begin="1">
    Locale: ${loc.displayName}
    <br />
     Locale country: ${loc.displayCountry}
   <br />
    Locale language: ${loc.displayLanguage}
  <br /><br />
</c:forEach>

</body>
</html>


           
       








Related examples in the same category

1.Locale info
2.Current Locale
3.JSP: Define the string in tag (I18N)
4.JSP Internationalization and Localized Content 1JSP Internationalization and Localized Content 1
5.JSP Internationalization and Localized Content 2JSP Internationalization and Localized Content 2
6.JSP Internationalization and Localized Content:Currency Formatting and locales
7.JSP Internationalization and Localized Content: Date Formatting and locale
8.Internationalized Web Applications: JavaServer Pages