• 大小: 1.74MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-15
  • 语言: 其他
  • 标签: struts  hibernate  

资源简介

struts+hibernate简单的学生管理信息系统的完整源码 适合初学者

资源截图

代码片段和文件信息

package com.cza;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.dao.HibernateSessionFactory;
import com.dao.StuInf;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class DeleteAction extends ActionSupport implements ModelDriven{
private StuI stu = new StuI();
private StuInf stuinf = new StuInf();

public String execute() {
String result = delete(stu.getStunum());
return result;
}

public String delete(String id){
Session session=HibernateSessionFactory.getSession();
Transaction ts=session.beginTransaction();
Query query=session.createQuery(“from StuInf where stunum=‘“+id+“‘“);
List list=query.list();
session.clear();
if(list.size()== 1)
{
Query delete=session.createQuery(“delete StuInf as stuinf where stunum=‘“+id+“‘“);
delete.executeUpdate();
ts.commit();
session.close();
return “success“;
}
else
return “false“;
}
public StuI getModel() {
// TODO Auto-generated method stub
return stu;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-06-18 19:19  test1\
     文件         862  2015-06-27 13:54  test1\.classpath
     目录           0  2015-06-18 19:20  test1\.myeclipse\
     文件         534  2015-06-27 13:54  test1\.myhibernatedata
     文件         289  2015-06-27 13:54  test1\.mymetadata
     文件         240  2015-06-27 13:54  test1\.mystrutsdata
     文件        1696  2015-06-27 13:54  test1\.project
     目录           0  2015-06-18 19:19  test1\.settings\
     文件         500  2015-06-27 13:54  test1\.settings\.jsdtscope
     文件         130  2015-06-27 13:54  test1\.settings\com.genuitec.eclipse.core.prefs
     文件        1040  2015-06-27 13:54  test1\.settings\com.genuitec.eclipse.j2eedt.core.prefs
     文件         330  2015-06-27 13:54  test1\.settings\org.eclipse.jdt.core.prefs
     文件          49  2015-06-27 13:54  test1\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2015-06-27 13:54  test1\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2015-06-18 19:19  test1\src\
     目录           0  2015-06-18 19:19  test1\src\com\
     目录           0  2015-06-18 19:19  test1\src\com\cza\
     文件        1140  2015-06-27 13:54  test1\src\com\cza\DeleteAction.java
     文件        1276  2015-06-27 13:54  test1\src\com\cza\InsertAction.java
     文件        1082  2015-06-27 13:54  test1\src\com\cza\List2Action.java
     文件        1088  2015-06-27 13:54  test1\src\com\cza\ListAction.java
     文件        1696  2015-06-27 13:54  test1\src\com\cza\LoginAction.java
     文件        1661  2015-06-27 13:54  test1\src\com\cza\Modify2Action.java
     文件        1386  2015-06-27 13:54  test1\src\com\cza\ModifyAction.java
     文件        1187  2015-06-27 13:54  test1\src\com\cza\RegisterAction.java
     文件        1166  2015-06-27 13:54  test1\src\com\cza\StuI.java
     文件         399  2015-06-27 13:54  test1\src\com\cza\User.java
     目录           0  2015-06-18 19:19  test1\src\com\dao\
     文件        3188  2015-06-27 13:54  test1\src\com\dao\HibernateSessionFactory.java
     文件        1345  2015-06-27 13:54  test1\src\com\dao\StuInf.hbm.xml
     文件        1412  2015-06-27 13:54  test1\src\com\dao\StuInf.java
............此处省略55个文件信息

评论

共有 条评论