Arabic language in jsp example

Arabic language in jsp example

Arabic in jsp:

Encoding should be changed:

We need to change the pageEncoding and charset to utf-8 inorder to get the arabic output. If we leave pageEncoding and charset to “ISO-8859-1” then it will not allow to save the arabic content in the jsp page. If we save by force then it will changed to “??????????” like this. So we must change the encoding and charset to “utf-8” to get the arabic output.

Should use dir attribute (rtl – right to left):

As well as we have to use the dir attribute for the div(in the below program we have used for the div) or whole html or span etc…

dir attirbute will have the two values as like below,

dir = rtl (right to left)

dir = ltr (left to right)

Arabic Language – sample jsp Program:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//AR" "http://www.w3.org/TR/html4/loose.dtd">
<%@page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<html>
<head>
<title>ArabicJsp</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="GENERATOR" content="Rational Application Developer">
</head>
<body>
<div dir="rtl">ثقافة وفنون</div>
</body>
</html>

 

Output:

arabic in jsp

 

 

 

Thanks for reading this post…………!!!

924 total views, 4 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.