• 大小: 10.27MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-24
  • 语言: 其他
  • 标签: struts2  hibernate  

资源简介

简单的使用Struts2+hibernate框架合并的学生信息管理小项目,适合初学者参考使用,大神请绕道

资源截图

代码片段和文件信息

package com.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.modle.Student;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.service.StudentService;
import com.serviceimpl.StudentServiceImpl;

public class StudentAction extends ActionSupport implements ModelDriven{

/**
 * 
 */
private static final long serialVersionUID = 1L;
private StudentService stu=new StudentServiceImpl();
private List list;
private int pageIndex=1;
public int getPageIndex() {
return pageIndex;
}


public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}


public List students(){

list=stu.selectList();
System.out.println(“+++++students list:“+list.size());

return list;
}


//list
public String list(){

list=students();
System.out.println(“Action list:“+list.size());
return list.size()>0?“ListSuccess“:ERROR;
}
//save
public String save(){
System.out.println(“+++++++++action  save+++++++++“);
if (stu.save(student)) {
list=students();
return “editsuccess“;
}else{
return ERROR;
}

}

//select
public String listbyname(){
System.out.println(“+++++selectlistbynameAction++++++“);
list=students();
System.out.println(list.size());
return list.size()>0?“Listbyname“:ERROR;
}
public String listbyname1(){
System.out.println(“+++++selectlistbynameAction++++++“);
System.out.println(“++++++“+student.getSsname()+“+++++++“);
list=stu.selectbyname(student.getSsname());
System.out.println(list.size());
return list.size()>0?“Listbyname“:ERROR;
}


//edit
public String edit(){
System.out.println(“+++++++++action edit+++++++“);
list=students();
return list.size()>0?“editsuccess“:ERROR;
}


//modify
public String modify(){
System.out.println(“+++++++action modify++++++“);
return “modify“;
}

public String modify1(){
System.out.println(“++++++++modify in action++++++“);
System.out.println(student.toString());

if(stu.update(student)){
list=students();
return “editsuccess“;
}else{
return ERROR;
}
}

//delete
public String delete(){
System.out.println(“-----------action delete--------------“);
System.out.println(student.getSsno());
if (stu.delete(student.getSsno())) {
list=students();
return “editsuccess“;
}else{
return ERROR;
}
}


//listbypage
public String listbypage(){

System.out.println(“----------listbypage-------------“);
List students=stu.selectList();
int pageCount;//总页数
int countPrePage=3;//每页显示记录数
int studentCou

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-04-06 16:18  FirstHibernate\
     文件        5808  2017-04-07 17:52  FirstHibernate\.classpath
     文件         914  2017-03-28 10:38  FirstHibernate\.project
     目录           0  2017-03-28 10:38  FirstHibernate\.settings\
     文件         567  2017-03-28 10:38  FirstHibernate\.settings\.jsdtscope
     文件         364  2017-03-28 10:38  FirstHibernate\.settings\org.eclipse.jdt.core.prefs
     文件         573  2017-03-28 10:42  FirstHibernate\.settings\org.eclipse.wst.common.component
     文件         305  2017-03-28 10:38  FirstHibernate\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-03-28 10:38  FirstHibernate\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-03-28 10:38  FirstHibernate\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-03-28 10:38  FirstHibernate\build\
     目录           0  2017-04-07 17:52  FirstHibernate\build\classes\
     文件         817  2016-06-15 08:53  FirstHibernate\build\classes\.classpath
     文件        1021  2016-06-15 08:53  FirstHibernate\build\classes\.project
     目录           0  2017-04-07 17:52  FirstHibernate\build\classes\.settings\
     文件         491  2016-06-15 08:53  FirstHibernate\build\classes\.settings\.jsdtscope
     文件         357  2016-06-15 08:53  FirstHibernate\build\classes\.settings\org.eclipse.jdt.core.prefs
     文件         516  2016-06-15 08:53  FirstHibernate\build\classes\.settings\org.eclipse.wst.common.component
     文件         335  2016-06-15 08:53  FirstHibernate\build\classes\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2016-06-15 08:53  FirstHibernate\build\classes\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2016-06-15 08:53  FirstHibernate\build\classes\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-04-07 17:52  FirstHibernate\build\classes\com\
     目录           0  2017-04-07 18:40  FirstHibernate\build\classes\com\action\
     文件        4992  2017-04-07 21:25  FirstHibernate\build\classes\com\action\StudentAction.class
     目录           0  2017-04-07 17:52  FirstHibernate\build\classes\com\db\
     文件         699  2017-04-07 17:52  FirstHibernate\build\classes\com\db\Myhibernate.class
     目录           0  2017-04-07 17:52  FirstHibernate\build\classes\com\modle\
     文件        2203  2017-04-07 17:52  FirstHibernate\build\classes\com\modle\Student.class
     目录           0  2017-04-07 21:10  FirstHibernate\build\classes\com\service\
     目录           0  2017-04-07 17:52  FirstHibernate\build\classes\com\serviceimpl\
     文件        5031  2017-04-07 21:32  FirstHibernate\build\classes\com\serviceimpl\StudentServiceImpl.class
............此处省略67个文件信息

评论

共有 条评论