资源简介

很好用的学生信息管理系统,可以用来应付老师的作业,Struts2+hibernate+spring。带mysql数据库。

资源截图

代码片段和文件信息

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();

return list;
}


//list
public String list(){

list=students();

return list.size()>0?“ListSuccess“:ERROR;
}
//save
public String save(){

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

}

//select
public String listbyname(){

list=students();

return list.size()>0?“Listbyname“:ERROR;
}
public String listbyname1(){

list=stu.selectbyname(student.getSsname());
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(){
return “modify“;
}

public String modify1(){
System.out.println(student.toString());

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

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


//listbypage
public String listbypage(){

List students=stu.selectList();
int pageCount;//总页数
int countPrePage=3;//每页显示记录数
int studentCount;//记录数
int startSelect = 0;

studentCount=students.size();
HttpServletRequest request=ServletActionContext.getRequest();
HttpSession session=request.getSession();


session.setAttribute(“studentCount“ studentCount);

if(studentCount%countPrePage==0){//计算总页数
pageCount=studentCount/countPrePage;

}else{
pageCount=studentCount/countPrePage+1;
}


if (pageIndex==0) {
startSelect=0;

System.out.println(“1111111:“+startSelect);
}else{
startSelect=pageIndex*3-3;
}

session.setAttribute(“pageCount“ pageCount);
session.setAttribute(“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3195  2018-12-28 11:23  FirstHibernate\.classpath

     文件        914  2018-12-28 11:23  FirstHibernate\.project

     文件        567  2018-12-28 11:23  FirstHibernate\.settings\.jsdtscope

     文件        364  2018-12-28 11:23  FirstHibernate\.settings\org.eclipse.jdt.core.prefs

     文件        573  2018-12-28 11:23  FirstHibernate\.settings\org.eclipse.wst.common.component

     文件        305  2018-12-28 11:23  FirstHibernate\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-12-28 11:23  FirstHibernate\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-12-28 11:23  FirstHibernate\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件        817  2018-12-28 11:23  FirstHibernate\build\classes\.classpath

     文件       1021  2018-12-28 11:23  FirstHibernate\build\classes\.project

     文件        491  2018-12-28 11:23  FirstHibernate\build\classes\.settings\.jsdtscope

     文件        357  2018-12-28 11:23  FirstHibernate\build\classes\.settings\org.eclipse.jdt.core.prefs

     文件        516  2018-12-28 11:23  FirstHibernate\build\classes\.settings\org.eclipse.wst.common.component

     文件        335  2018-12-28 11:23  FirstHibernate\build\classes\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-12-28 11:23  FirstHibernate\build\classes\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-12-28 11:23  FirstHibernate\build\classes\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       4497  2018-12-28 11:23  FirstHibernate\build\classes\com\action\StudentAction.class

     文件        699  2018-12-28 11:23  FirstHibernate\build\classes\com\db\Myhibernate.class

     文件       2203  2018-12-28 11:23  FirstHibernate\build\classes\com\modle\Student.class

     文件        549  2018-12-28 11:23  FirstHibernate\build\classes\com\service\StudentService.class

     文件       4789  2018-12-28 11:23  FirstHibernate\build\classes\com\serviceimpl\StudentServiceImpl.class

     文件       1040  2018-12-28 11:23  FirstHibernate\build\classes\ehcache.xml

     文件       1412  2018-12-28 11:23  FirstHibernate\build\classes\hibernate.cfg.xml

     文件       1735  2018-12-28 11:23  FirstHibernate\build\classes\log4j.properties

     文件        769  2018-12-28 11:23  FirstHibernate\build\classes\struts.xml

     文件        748  2018-12-28 11:23  FirstHibernate\build\classes\Student.hbm.xml

     文件        817  2018-12-28 11:23  FirstHibernate\configer\.classpath

     文件       1021  2018-12-28 11:23  FirstHibernate\configer\.project

     文件        491  2018-12-28 11:23  FirstHibernate\configer\.settings\.jsdtscope

     文件        357  2018-12-28 11:23  FirstHibernate\configer\.settings\org.eclipse.jdt.core.prefs

............此处省略88个文件信息

评论

共有 条评论