求助,为什么点击注册后一直在刷新,数据库里也没载入数据
try{ Class.forName("com.mysql.jdbc.Driver");}
catch(Exception e){}
Connection con;
Statement sql;
ResultSet rs;
String condition="INSERT INTO user VALUES";
condition+="("+"'"+name;
condition+="','"+password+"')";
try{
byte [] b=condition.getBytes("ISO-8859-1");
condition=new String(b);
String uri="jdbc:mysql://localhost/shangjiang";
con=DriverManager.getConnection(uri,"root","root");
sql=con.createStatement();
sql.executeUpdate(condition);
con.close();
byte [] c=name.getBytes("iso-8859-1");
name=new String(c);
String mess="恭喜"+name+"注册成功";
jspContext.setAttribute("backMess",mess);
con.close();
}
catch(Exception e){
jspContext.setAttribute("backMess","没有填写用户名或者用户名已经被注册");
}
}
else{
jspContext.setAttribute("backMess","注册失败");}
%>
}
%>