一、源码特点
java ssh学生管理系统是一套完善的web设计系统(系统采用ssh框架进行设计开发),对理解JSP java编程开发语言有帮助,系统具有完整的源代码和数据库,系统主要采用B/S模
式开发。开发环境为TOMCAT7.0,Myeclipse8.5开发,数据库为Mysql5.0,使用java语言开发。
ssh 学生管理系统
二、功能介绍
满足系统不同用户角色的应用需求:根据需要,系统应对两种用户按其使用功能和权限进行角色划分,形成三种角色,分别是:
1.管理员:具有管理员信息管理与查看,学生信息管理与查看,教师信息管理与查看,课程信息管理与查看,成绩信息管理与查看;
2.学生:课程浏览、成绩浏览、个人信息修改;
3.教师:课程浏览、成绩管理、个人信息修改;
具体功能如下:
(1)管理员管理:对管理员信息进行添加、删除、修改和查看
(2)学生管理:对学生信息进行添加、删除、修改和查看
(3)教师管理:对教师信息进行添加、删除、修改和查看
(4)课程管理:对课程信息进行添加、删除、修改和查看
(5)成绩管理:对成绩信息进行添加、删除、修改和查看
系统ER 图
控制层代码
public String add()
{//对表chengji进行添加操作
int num=0;
String sql="";
ResultSet rs=null;
DBO db=new DBO();
try{
sql="select count(1) as num from chengji where kc='"+chengji.getKc()+"' and xs='"+chengji.getXs()+"'";
rs=db.query(sql);
if(rs.next()){
num=rs.getInt("num");
}
if(num>0){
ServletActionContext.getRequest().setAttribute("msg", "<script>alert('添加失败,数据重复');</script>");
}else {
ServletActionContext.getRequest().setAttribute("msg", "<script>alert('添加成功');</script>");
dao.addchengji(chengji);
}
}catch(Exception e){
System.out.println(e.toString());
}finally{
db.close();
}
return "chengjiadd";
}
public String list()
{//对成绩进行管理 对表chengji进行页面查询
int size=10;//分页个数
try{
String hql=" from chengji where 1=1";
String xs="";
String kc="";
if(ServletActionContext.getRequest().getParameter("xs")!=null){
xs=ServletActionContext.getRequest().getParameter("xs").toString();
if(!xs.equals("")){
hql+=" and xs='"+ServletActionContext.getRequest().getParameter("xs").toString()+"'";
}
}
if(ServletActionContext.getRequest().getParameter("kc")!=null){
kc=ServletActionContext.getRequest().getParameter("kc").toString();
if(!kc.equals("")){
hql+=" and kc='"+ServletActionContext.getRequest().getParameter("kc").toString()+"'";
}
}
int count=dao.getchengjis(hql).size();
pageCount=count%size==0?count/size:(count/size+1);
if(pageNum<1)
{
pageNum=1;
}else if(pageNum>pageCount)
{
pageNum=pageCount;
}
chengjis=dao.getchengjis(hql, pageNum, size);
}catch(Exception e){
System.out.println(e.toString());
}
return "chengjilist";
}
public String listp()
{//对成绩进行管理 对表chengji进行查询
try{
String sql=" from chengji where 1=1";
if(ServletActionContext.getRequest().getSession().getAttribute("yhm")!=null){
sql+=" and xs='"+ServletActionContext.getRequest().getSession().getAttribute("yhm").toString()+"'";
}
chengjis=dao.getchengjis(sql);
}catch(Exception e){
System.out.println(e.toString());
}
return "chengjilistp";
}
public String del()
{//对成绩进行删除 对表chengji进行删除
String keyid=ServletActionContext.getRequest().getParameter("keyid").toString();
chengji tempbean=dao.getchengji("from chengji where cjid="+keyid);
try{
dao.delchengji(tempbean);
}catch(Exception e){
System.out.println(e.toString());
}
ServletActionContext.getRequest().setAttribute("msg", "<script>alert('删除成功');</script>");
return list();
}
持久层代码
public int addchengji(chengji u)
{
return addObj(u);
}
/*
对表chengji进行删除操作
*/
public void delchengji(chengji u)
{
delObj(u);
}
/*
对表chengji进行查询单条记录返回一个实体bean对象
*/
public chengji getchengji(String hql)
{
return (chengji)getObjByHql(hql);
}
@SuppressWarnings("unchecked")
/*
对表chengji查询结果集体操作
*/
public List<chengji> getchengjis(DetachedCriteria dc,int pageNum,int size)
{
return (List<chengji>)getObjs(dc, (pageNum-1)*size, size);
}
/*
对表chengji查询结果集体操作
*/
public List<chengji> getchengjis(String hql)
{
return (List<chengji>)getObjsByHql(hql);
}
@SuppressWarnings("unchecked")
/*
对表chengji查询结果集体操作
*/
public List<chengji> getchengjis(String hql,int pageNum,int size)
{
return (List<chengji>)getObjsByHql(hql,(pageNum-1)*size,size);
}
hibernate 配置文件
<property name="kc" type="java.lang.String">
<column name="kc" length="40">
<comment>课程</comment>
</column>
</property>
<property name="xs" type="java.lang.String">
<column name="xs" length="40">
<comment>学生</comment>
</column>
</property>
<property name="cj" type="java.lang.String">
<column name="cj" length="40">
<comment>成绩</comment>
</column>
</property>
<property name="djsj" type="java.lang.String">
<column name="djsj" length="40">
<comment>登记时间</comment>
</column>
</property>
</class>
三、注意事项
1、管理员账号:admin 密码:admin 数据库配置文件applicationContext.xml
2、开发环境为TOMCAT7.0,Myeclipse8.5开发,数据库为Mysql5.0,使用java语言开发。
3、数据库文件名是jspsshstu.sql,系统名称sshstu
4、系统首页地址:http://127.0.0.1:8080/sshstu/login.jsp
四 系统实现
源码获取 下方联系卡片↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓