Re: Q How to display Hindi text on JSP using Resource Bundle and properties file ?
How to display Hindi text on JSP using Resource Bundle and properties
file ?
I am trying to display Hindi Text on jsp page using resource bundle
and
properties file but its not showing hindi text.
text look like :->
=A4=AE =E0=A4=86=E0=A4=AA=E0=A4=B7=E0=A5=87
I kept all properties file in classes folder.
My JSP code :->
<%@page pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" language="java"
import="java.sql.*" errorPage="" %>
<%@ page import = "java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Localization</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
Hindi content
<div style="display:block; position:absolute; width:500px;
height:
500px; background:#FFCCCC; left: 234px; top: 49px;">
<%
try{
String language;
String country;
language = new String("hi");
country = new String("IN");
Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale(language,
country);
messages =
ResourceBundle.getBundle("MessagesBundle",currentLocale);
out.println(messages.getString("greetings"));
out.println(messages.getString("inquiry"));
out.println(messages.getString("farewell"));
}catch(Exception ex){
System.out.println("***exception***:->
"+ex);
}
%>
</div>
</body>
</html>
MessagesBundle.properties file :->
greetings = Hello.
farewell = Goodbye.
inquiry = How are you?
MessagesBundle_hi_IN.properties file :->
greetings =
farewell = .
inquiry = !