資源簡介
學生管理系統(tǒng)struts2+hibernate實現(xiàn)適合課程設計
代碼片段和文件信息
package?action;
import?java.text.ParseException;
import?java.text.SimpleDateFormat;
import?java.util.List;
import?entity.Students;
import?service.StudentsDAO;
import?service.impl.StudentsDAOImpl;
public?class?StudentsAction?extends?SuperAction?{
private?static?final?long?serialVersionUID?=?1L;
//?查詢所有學生的動作
public?String?query()?{
StudentsDAO?sdao?=?new?StudentsDAOImpl();
List?list?=?sdao.queryAllStudents();
//放進session中
if(list!=null&&list.size()>0){
session.setAttribute(“students_list“l(fā)ist);
}
return?“query_success“;
}
//刪除
public?String?delete(){
StudentsDAO?sdao=new?StudentsDAOImpl();
????String?sid=request.getParameter(“sid“);
????sdao.deleteStudents(sid);//調(diào)用刪除方法
????return?“delete_success“;
??}
//添加學生
public?String?add()?throws?Exception{
Students?s=new?Students();
s.setSname(request.getParameter(“sname“));
s.setGender(request.getParameter(“gender“));
SimpleDateFormat?sdf=new?SimpleDateFormat(“yyyy-MM-dd“);
s.setBirthday(sdf.parse(request.getParameter(“birthday“)));
s.setAddress(request.getParameter(“address“));
StudentsDAO?sdao=new?StudentsDAOImpl();
sdao.addStudents(s);
return?“add_success“;
}
//修改
public?String?modify(){
//獲得傳遞過來的學生
String?sid=request.getParameter(“sid“);
StudentsDAO?sdao=new?StudentsDAOImpl();
Students?s=sdao.queryStudentsBySid(sid);
session.setAttribute(“modify_students“?s);
return?“modify_success“;
}
public?String?save()?throws?Exception{
Students?s=new?Students();
s.setSid(request.getParameter(“sid“));
s.setSname(request.getParameter(“sname“));
s.setGender(request.getParameter(“gender“));
SimpleDateFormat?sdf=new?SimpleDateFormat(“yyyy-MM-dd“);
s.setBirthday(sdf.parse(request.getParameter(“birthday“)));
s.setAddress(request.getParameter(“address“));
StudentsDAO?sdao=new?StudentsDAOImpl();
sdao.updateStudents(s);
return?“save_success“;
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-10-17?15:50??StudentBySH\
?????文件????????2788??2015-10-17?18:09??StudentBySH\.classpath
?????文件?????????399??2015-10-17?15:14??StudentBySH\.myhibernatedata
?????文件????????1336??2015-10-17?17:28??StudentBySH\.project
?????目錄???????????0??2015-10-17?15:01??StudentBySH\.settings\
?????文件?????????522??2015-10-17?15:01??StudentBySH\.settings\.jsdtscope
?????文件?????????364??2015-10-17?15:01??StudentBySH\.settings\org.eclipse.jdt.core.prefs
?????文件?????????559??2015-10-17?15:50??StudentBySH\.settings\org.eclipse.wst.common.component
?????文件?????????515??2015-10-17?15:14??StudentBySH\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2015-10-17?15:01??StudentBySH\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2015-10-17?15:01??StudentBySH\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2015-10-17?17:23??StudentBySH\WebRoot\
?????目錄???????????0??2015-10-17?15:01??StudentBySH\WebRoot\me
?????文件??????????39??2015-10-17?15:01??StudentBySH\WebRoot\me
?????目錄???????????0??2015-10-17?15:01??StudentBySH\WebRoot\WEB-INF\
?????目錄???????????0??2015-10-17?18:07??StudentBySH\WebRoot\WEB-INF\lib\
?????文件??????445288??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\antlr-2.7.7.jar
?????文件???????43578??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\asm-3.3.jar
?????文件???????38275??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\asm-commons-3.3.jar
?????文件???????21503??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\asm-tree-3.3.jar
?????文件???????59590??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\commons-fileupload-1.2.2.jar
?????文件??????159509??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\commons-io-2.0.1.jar
?????文件??????315805??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\commons-lang3-3.1.jar
?????文件??????313898??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\dom4j-1.6.1.jar
?????文件??????931168??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\freemarker-2.3.19.jar
?????文件???????81830??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\hibernate-commons-annotations-4.0.2.Final.jar
?????文件?????4623753??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\hibernate-core-4.2.4.Final.jar
?????文件??????102661??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\hibernate-jpa-2.0-api-1.0.1.Final.jar
?????文件??????614203??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\javassist-3.11.0.GA.jar
?????文件??????648253??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\javassist-3.15.0-GA.jar
?????文件???????60768??2015-10-17?18:06??StudentBySH\WebRoot\WEB-INF\lib\jboss-logging-3.1.0.GA.jar
............此處省略103個文件信息
- 上一篇:圖書管理系統(tǒng)借書還書等操作
- 下一篇:EDLines檢測,快速檢測直線
評論
共有 條評論