| | |
jsp localisation
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Nov 2008
Posts: 27
Reputation:
Solved Threads: 0
Dear Friends,
I a working on a project where i have to let the user to type in other languages(hindi,tamil,kannada etc..) and i have to store into the database and retrive it back and show it to the client in the same language he has entered..I am using postgres 8.0 for storing the data. When i tried to store the data's its storing in database as "ल�ि�प�िप�" and displaying it in the same manner...Can any one help me how to fix this..Thanks in advance
i use the following code to store
english.jsp
jdbcConnection.jsp
Regards,
Jayaprakash
I a working on a project where i have to let the user to type in other languages(hindi,tamil,kannada etc..) and i have to store into the database and retrive it back and show it to the client in the same language he has entered..I am using postgres 8.0 for storing the data. When i tried to store the data's its storing in database as "ल�ि�प�िप�" and displaying it in the same manner...Can any one help me how to fix this..Thanks in advance
i use the following code to store
english.jsp
html Syntax (Toggle Plain Text)
<input type="button" name="but1" value="<%=session.getValue("main.Bok")%> " onClick="callSearch()"> function callSearch() { var f = document.forms[0];//("myform"); var semiCol = ":"; var Name = document.myForm.Name.value; var Company = document.myForm.Company.value; var DOB = document.myForm.DOB.value; var Age = document.myForm.Age.value; // parent.document.getElementById("Local").src="jdbcConnection.jsp?Name="+Name+"&Company="+Company+"&DOB="+DOB+"&Age="+Age; alert("Name = "+Name); window.location.href="./jdbcConnection.jsp?Name="+Name+"&Company="+Company+"&DOB="+DOB+"&Age="+Age; }
jdbcConnection.jsp
JSP Syntax (Toggle Plain Text)
<% request.setCharacterEncoding("UTF-8"); String szName=request.getParameter("Name"); System.out.println("Name = "+szName); String szCompany=request.getParameter("Company"); System.out.println("Company = "+szCompany); String szDOB=request.getParameter("DOB"); System.out.println("DOB = "+szDOB); String szAge=request.getParameter("Age"); System.out.println("Age = "+szAge); try{ Connection conn; String szUrl; Class.forName("org.postgresql.Driver"); szUrl="jdbc:postgresql://localhost/jaiprakash"; System.out.println("Driver created"); conn = DriverManager.getConnection(szUrl,"postgres","password"); System.out.println("Connection created"); Statement sqlString1=conn.createStatement(); sqlString1.executeUpdate("INSERT INTO public.user values('"+szName+"','"+szCompany+"','"+szDOB+"','"+szAge+"')"); //sqlString1.executeUpdate("INSERT INTO public.user values('gfgfdg','gffdggf','gdfgdfg','gdfgdfg')"); System.out.println("Query executed...."); conn.close(); }catch(Exception e){ e.printStackTrace(); } %>
Regards,
Jayaprakash
Last edited by peter_budo; Jan 31st, 2009 at 4:48 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Make sure your database/table is created with Unicode as the encoding. Refer the Postgresql forums/documentation for more details.
Also try getting the connection with the URL which also specifies the character set explicitly.
Also try getting the connection with the URL which also specifies the character set explicitly.
JSP Syntax (Toggle Plain Text)
jdbc:postgresql://localhost:5432/testdb?charSet=YOUR-ENCODING-HERE
I don't accept change; I don't deserve to live.
•
•
Join Date: Nov 2008
Posts: 27
Reputation:
Solved Threads: 0
Thanks for the reply.. I have solved the Thread by changing the database version.. From 8.0 to 8.3(Supports UTF-8 encoding)
I have removed the function call search and changed the method
Now it is working fine...
I have removed the function call search and changed the method
JSP Syntax (Toggle Plain Text)
<form name="myForm" ID="Local" method="POST" action="jdbcConnection.jsp">
Now it is working fine...
DB connection from JSP is something which you should not do it. For better wait to communicate with DB see this post
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Other Threads in the JSP Forum
- Previous Thread: CrystalReport with JSP
- Next Thread: centralized and more secure way of authentication
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






