日期:2014-05-18  浏览次数:20830 次

一个很奇怪的问题!如果能解决 不够分您开腔!
我有一个.html页面.把里面的值提交给一个servlet 具体代码如下:
package   model;

import   java.io.*;
import   javax.servlet.http.*;
import   java.util.*;
import   java.sql.*;

import   javax.servlet.*;


public   class   dcservlet   extends   HttpServlet   {
                private   static   final   String   CONTENT_TYPE= "text/html;charset=GBK ";
                private   String   comeOutStr= " ";
                private   int   comeOutInt=0;
                private   static   Connection   con;
                private   Statement   stmt;
                  private   static   final   String   drivername= "org.gjt.mm.mysql   Driver ";
                  private   static   final   String   url= "jdbc:mysql://localhost/zqswork02?user=root&password=root&useUnicode=true&characterEncoding=gb2312 ";
                  public   static   Connection   getCon()   throws   Exception   {
                  try   {
                  Class.forName(drivername);
                  con=DriverManager.getConnection(url);
                  return   con;                  

}   catch   (SQLException   e)   {
System.err.println(e.getMessage());
throw   e;
}

}
                public   Statement   getStmtread()   {
                try   {
con=getCon();
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
return   stmt;
}   catch   (Exception   e)   {
System.err.println(e.getMessage());
e.printStackTrace();
}
return   null;
}




public   void   doPost(HttpServletRequest   request,   HttpServletResponse   response)
throws   ServletException,   IOException   {

response.setContentType(CONTENT_TYPE);
PrintWriter   out   =   response.getWriter();
out.println( " <!DOCTYPE   HTML   PUBLIC   \ "-//W3C//DTD   HTML   4.01   Transitional//EN\ "> ");
out.println( " <HTML> ");
out.println( "     <HEAD> <TITLE> A   Servlet </TITLE> </HEAD> ");
out.println( "     <BODY> ");