sql-serverjspfontsregional

Regional Font in SqlServer to jsp


I have an SQL Server 2012 DB and I have stored some regional fonts (Language: Tamil, India) in some table. Now, I have written a jsp code to display the results, but all I can see is ??? and not the actual font. Here's my code:

try{

//Class.forName("net.sourceforge.jtds.jdbc.Driver");
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = java.sql.DriverManager.getConnection(url, id, pass);
System.out.println("Connected database successfully...");
}catch(ClassNotFoundException cnfex){
cnfex.printStackTrace();

}
String sql = "select ID, Genre, BookName, Author, Owner, Status from Tam_Books";
try{//try start
s = con.createStatement();
rs = s.executeQuery(sql);
%>
<table style="border: 1px solid black">
<tr>
<th style="border: 1px solid black">ID</th>
<th style="border: 1px solid black">Genre</th>
<th style="border: 1px solid black">Book Name</th>
<th style="border: 1px solid black">Author</th>
<th style="border: 1px solid black">Owner</th>
<th style="border: 1px solid black">Status</th>
</tr>
<%
while( rs.next() ){ //while start
%>
<tr>
<td style="border: 1px solid black"><%= rs.getString("ID") %></td>
<td style="border: 1px solid black"><%= rs.getString("Genre") %></td>
<td style="border: 1px solid black"><%= rs.getString("BookName") %></td>
<td style="border: 1px solid black"><%= rs.getString("Author") %></td>
<td style="border: 1px solid black"><%= rs.getString("Owner") %></td>
<td style="border: 1px solid black"><%= rs.getString("Status") %></td>
</tr>
<%
} //while end
%>

<%

} //try end
catch(Exception e){e.printStackTrace();}
finally{
if(rs!=null) rs.close();
if(s!=null) s.close();
if(con!=null) con.close();
}

%>
</table>

As stated, I get the result, nothing wrong with the code, but I can't get the font right. All it displays is ?? in the table. Is there a way we can include something to update the right font?

EDIT: I don't run jsp with any instances, but I write the jsp, copy the file in the tomcat installation root folder and access the file as http://localhost:8080/filename.jsp

Thanks much in advance, Balaji


Solution

  • Found the answer myself. I just had to add the following line:

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>