这是一个图书馆管理系统的jsp代码
源代码在线查看: modifyuser.jsp~16~
无标题文档
.style3 {font-size: 24px}
.style4 {font-size: 18px}
-->
Adduser
Modifyuser
Deletuser
Searchuser
BookMenu
Modify user
ID:
***
Course:
Number:
Code:
Phone:
Email:
Oicq:
Maxbook:
String id = request.getParameter("modifyuserid");
String course = request.getParameter("modifyusercourse");
String studentnumber = request.getParameter("modifyusernumber");
String code = request.getParameter("modifyusercode");
String phone = request.getParameter("modifyuserphone");
String email = request.getParameter("modifyuseremail");
String oicq = request.getParameter("modifyuserqq");
String maxbook = request.getParameter("modifyusermax");
try{
if(request.getParameter("modifyuserenter")!=null && id!=null){
Connection conn=Library.getConn();
Statement stmt=conn.createStatement();
if(course!=null){
String updatecourse = "update user set course ='" + course +"' where id ='" + id + "'";
stmt.execute(updatecourse);}
if(studentnumber!=null){
String updatenumber = "update user set studentnumber ='" + studentnumber +"' where id ='" + id + "'";
stmt.execute(updatenumber);}
if(code!=null){
String updatecode = "update user set code ='" + code +"' where id ='" + id + "'";
stmt.execute(updatecode);}
if(phone!=null){
String updatephone = "update user set phone ='" + phone +"' where id ='" + id + "'";
stmt.execute(updatephone);}
if(email!=null){
String updateemail = "update user set email ='" + email +"' where id ='" + id + "'";
stmt.execute(updateemail);}
if(oicq!=null){
String updateoicq = "update user set oicq ='" + oicq +"' where id ='" + id + "'";
stmt.execute(updateoicq);}
if(maxbook!=null){
String updatemax = "update user set maxbook ='" + maxbook +"' where id ='" + id + "'";
stmt.execute(updatemax);}
response.sendRedirect("success.jsp");
}
}catch (Exception ex) {
response.sendRedirect("fail.jsp");
ex.printStackTrace();}
%>