Input chinese thru web browser
Posted by: phyllis neo
Date: November 05, 2006 08:20PM

Hi, i am currently doing programming for a chinese company. i'm using netbeans 5.0 with mysql 5.0.

At first i encountered the problem of not being to input chinese at all but i've solved that problem now.

However, though i can input chinese char directly into MySQL(thru the edit button), i cannot do through the internet browser. I can pass chinese char from one page to the other but i just can't insert into MySQL. All that it shows will just be ??? Can anyone help?

----------------------------------------------------------------------------------

<%@page contentType="text/html"%>
<%@page pageEncoding="gbk"%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Lambda Autotechnik</title>
</head>
<body>

<form name=register method=post action="addUsers.jsp">
<table name=register cellpadding="0" cellspacing="5" border="0">
<tr>
<td>Login Name:
<td><input type=text name=loginID>
</tr>

<tr>
<td>Password:
<td><input type=password name=pwd>
</tr>

<tr>
<td>Name:
<td><input type=text name=name>
</tr>

<tr>
<td><input type=submit value=Submit>
</tr>

</table>
</form>


</body>
</html>

----------------------------------------------------------------------------------

<%@page contentType="text/html"%>
<%@page pageEncoding="gbk"%>

<jsp:useBean id="j" class="lambda.JavaMySQL" scope="session" />

<%

request.setCharacterEncoding("gbk");
String loginID = request.getParameter("loginID");
String pwd = request.getParameter("pwd");
String name = request.getParameter("name");

out.print(loginID);
out.print("<br>");
out.print(pwd);
out.print("<br>");
out.print(name);

j.connect();
int row = j.executeUpdate("Insert into chi values ('" +loginID+ "')");

if (row == 0){
out.print("<script>window.alert('Inventory could not be update')</script>");
}
else {
out.print("Users updated.");
}

%>
----------------------------------------------------------------------------------

Options: ReplyQuote


Subject
Views
Written By
Posted
Input chinese thru web browser
2928
November 05, 2006 08:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.