import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;public class Process extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { response.setContentType("text/html");
PrintWriter out = response.getWriter();

String name = request.getParameter("name");
String tel = request.getParameter("tel");
String email = request.getParameter("email");
String str = " ";
String url = "jdbc:mysql://localhost:3306/information";
Connection conn = null;
Statement stat = null;
ResultSet rs = null;
int x = 0;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(url,"root","123456");
stat = conn.createStatement();
rs = stat.executeQuery("select * from information");
x = 0;
while(rs.next())
{
str = rs.getString("name");
if(str.equals(name)&&x!=1)
{
out.println("<html xmlns='http://www.w3.org/1999/xhtml'>");
out.println("<head>");
out.println("<meta http-equiv='Content-Type' content='text/html; charset=gb2312' />");
out.println("<title>无标题文档</title>");
out.println("</head>");
out.println("<body>");
out.println("用户名存在,请重新填写");
out.println("<form action='index.html'><input type=submit value='返回' ></form>");
out.println("</body>");
out.println("</html>");
x = 1;
}
}
if(x==0)
{
stat.executeUpdate("insert into information values('"+name+"','"+tel+"','"+email+"')");
}
}catch(ClassNotFoundException e)
{
e.printStackTrace();
}catch(SQLException e)
{
e.printStackTrace();
}catch(Exception e)
{
e.printStackTrace();
}finally
{
try
{
stat.close();
conn.close();
}catch(Exception e)
{
e.printStackTrace();
}
}
out.println("welcome to here");
}
}当发送请求的时候显示的中文是?????了?