jsp中对Java定义的添加函数进行调用 求调用的jsp脚本 完成对数据库表中信息的添加操作
publicbooleaninsert(DepartmentUserdepartmentUser){booleanflag=false;DBUtildbUtil=newD...
public boolean insert(DepartmentUser departmentUser) { boolean flag = false; DBUtil dbUtil = new DBUtil(); String sql = "insert into 教师表 values('"+ departmentUser.getDeptID() + "'," + departmentUser.getUserName() + "', " + departmentUser.getUserSex() + "'," + departmentUser.getUserAddress() + "', " + departmentUser.getUserPhoneID() + "'," + departmentUser.getUserAge() + "'," + departmentUser.getUserPwd() + "' " + departmentUser.getUserID()+ "')"; System.out.println(sql); int n = dbUtil.update(sql); if(n != 1) { flag = false; } else { flag = true; } dbUtil.close(); return flag;
展开
1个回答
2015-06-19
展开全部
<%
Test test = new Test();
test.insert(user);
%>
Test test = new Test();
test.insert(user);
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询