详细解释
if(action.equals("addStu")){
String stu_ID=request.getParameter("stu_ID");
String stu_name=request.getParameter("stu_name");
String stu_password=request.getParameter("stu_password");
String stu_sfzID=request.getParameter("stu_sfzID");
String stu_shengri=request.getParameter("stu_shengri");
String stu_minzu=request.getParameter("stu_minzu");
String stu_sex=request.getParameter("sex");
String stu_zzmm=request.getParameter("stu_zzmm");
String stu_jiguan=request.getParameter("stu_jiguan");
String stu_address=request.getParameter("stu_address");
String stu_tel=request.getParameter("stu_tel");
String stu_Email=request.getParameter("stu_Email");
int stu_levelID=Integer.parseInt(request.getParameter("stu_level"));
int stu_professionalID=Integer.parseInt(request.getParameter("stu_professional"));
String stu_bz=request.getParameter("stu_bz");
StudentInf stu=new StudentInf();
stu.setStu_ID(code.getString(stu_ID));
stu.setStu_name(code.getString(stu_name));
stu.setStu_password(code.getString(stu_password));
stu.setStu_sfzID(code.getString(stu_sfzID));
stu.setStu_shengri(code.getString(stu_shengri));
stu.setStu_minzu(code.getString(stu_minzu));
stu.setStu_sex(code.getString(stu_sex));
stu.setStu_zzmm(code.getString(stu_zzmm));
stu.setStu_jiguan(code.getString(stu_jiguan));
stu.setStu_address(code.getString(stu_address));
stu.setStu_tel(code.getString(stu_tel));
stu.setStu_Email(code.getString(stu_Email));
stu.setStu_classID(stu_levelID);
stu.setStu_professionalID(stu_professionalID);
stu.setStu_bz(code.getString(stu_bz));
StudentDAO sdao=new StudentDAO();
if(sdao.insertStudetnInf(stu)){
request.setAttribute("reslut", "44");
request.getRequestDispatcher("success.jsp").forward(request, response);
}else{
out.println("<center background='/student/img/R6C.GIF'><h3><a href='/student/adminManager/addstu.jsp'>该学生已存在,请重新添加</h3></center>");
}
}
------解决方案--------------------这有什么好解释的,就是些查询和设定,
定义了一堆数据结构,从数据库提取数据付给对象stu
------解决方案--------------------
这。。new一个StudentInf 对象啊!这一句之前的代码都是从前台取值,new了它之后的代码,都是把取得值set给这个对象,就是赋值。
------解决方案--------------------
java三大特性之一 封装是面向对象方法的重要原则,就是把对象的属性和操作(或服务)结合为一个独立的整体,并尽可能隐藏对象的内部实现细节。
你这里就是把对象的属性封装在一个学生类中。。。