<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<html>
<BODY><FONT size=2>
<%
String name=request.getParameter("name");
 if(name==null)
 {name="";
 }
 //byte b[]=name.getBytes("ISO-8859-1");
 //name=new string(b);
 String newpassword=request.getParameter("password");
 if(newpassword==null)
 {newpassword="";
 }
 
 String newEmail=request.getParameter("Email");
 if(newEmail==null)
 {newEmail="";
 }
 String newsex=request.getParameter("sex");
 if(newsex==null)
 {newsex="";
 }

 String newqq=request.getParameter("qq");
 if(newqq==null)
 {newqq="";
 }
 String newaddress=request.getParameter("address");
  if(newaddress==null)
 {newaddress="";
 }
out.println(name);
out.println(newpassword);
out.println(newEmail);
out.println(newsex);
out.println(newqq);
out.println(newaddress);
         Connection conn=null;
         Statement sql=null;
         ResultSet rs=null;
       
         //String name,newpassword,newemail,newsex,newqq,newaddress;


  //String username=request.getParameter("username");
   //String password=request.getParameter("password");
  try{
      Class.forName("org.gjt.mm.mysql.Driver").newInstance();
      }
      catch(ClassNotFoundException e){}
      try{
      conn=DriverManager.getConnection("jdbc:mysql://localhost/test?user=root&password=laoji");
       sql=conn.createStatement();
       
        String condition="UPDATE user SET user_name='"+name+"',user_password='"+newpassword+"',user_email='"+newEmail+"',user_sex='"+newsex+"' ,user_qq='"+newqq+"',user_address='"+newaddress+"' where user_name='"+name+"'";
        stmt.executeUpdate(sql);
          
      
       int up=sql.executeUpdate(condition);
        if(up==1){
            
              
        }else{

        }
        
        
       rs=sql.executeQuery("select * from user ");
       out.print("<table border=1>");
            out.print("<tr>");
            out.print("<td width=100>username</td>");
            out.print("<td width=100>usersex</td>");
            out.print("<td width=100>userpassword</td>");
            out.print("<td width=100>Email</td>");
            out.print("<td width=100>QQ</td>");
            out.print("<td width=100>address</td>");
            out.print("<td width=100>birthday</td>");
      out.print("</tr>");
      while(rs.next()){
    out.print("<tr>");
          String e=rs.getString(1);
          out.print("<td>"+e+"</td>");
          String f=rs.getString(2);
          out.print("<td>"+f+"</td>");
          String g=rs.getString(3);
          out.print("<td>"+g+"</td>");
          String h=rs.getString(4);
          out.print("<td>"+h+"</td>");
          String i=rs.getString(5);
          out.print("<td>"+i+"</td>");
          String j=rs.getString(6);
          out.print("<td>"+j+"</td>");
         String k=rs.getString(7);
          out.print("<td>"+k+"</td>");
        out.print("</tr>");    
       }
      out.print("</table>");
      rs.close();
      sql.close();
      conn.close();
   }catch(Exception e1) {out.print(""+e1);}
%>
</body>
</html>
怎么才能实现更该数据库谢谢了!