保捱科技网
您的当前位置:首页实验报告管理系统报告

实验报告管理系统报告

来源:保捱科技网


软件项目设计报告

实验报告管理系统

所在班级 小组成员 学院名称 专业名称 指导教师 起止日期

12计卓

20120511218 江灵瞳 20120506143 印海平 20120506144 钱晨晨

信电工程学院 计算机科学与技术

胡局新

2014.12.16-2015.1.15

2015年

1月 15日

37

目 录

1 绪论 ...................................................................................................................................... 1 1.1开发背景 ............................................................................................................................ 1 实验教学是学生技能培养的重要环节之一,学生实验报告的质量在一定程度上反映了实验教学的质量,实验报告管理水平也反映了实验教学管理水平。目前,大部分学校所提交的实验报告大多还停留在以纸为介质的方式上,这将严重制约着实验教学的开展。首先,很多课程的实验结果在纸质实验报告中不能表现或不能完全表现,其次纸质实验报告的批改和分析也是实验授课老师的一个很重负担,如何提高学生实验报告的表象能力,提高教师批改实验报告的效率并及时发现和纠正实验报告中存在的问题是许多课程实验授课教师所面对的一个难题。 ..................................................................................... 1

1.2 本次设计完成的工作....................................................................................................... 1 1.3 任务分工 ........................................................................................................................... 1 1.4 任务 .................................................................................................................................... 1 2 系统分析 .................................................................................................................................. 2 2.1需求分析 ............................................................................................................................ 2 2.2可行性分析 ........................................................................................................................ 2 2.3 用例图................................................................................................................................ 2 3 系统设计与实现 ..................................................................................................................... 4 3.1系统目标 ............................................................................................................................ 4 3.2系统功能结构 .................................................................................................................... 4 3.3功能流程及工作流程 ........................................................................................................ 4 3.4系统流程图 ........................................................................................................................ 5 3.5构建开发环境 .................................................................................................................... 5 3.7文件夹组织结构 ................................................................................................................ 6 3.8 学生模块的实现 ............................................................................................................... 6 3.9 老师模块的实现 ............................................................................................................. 19

37

.......................................................................................................................................................... 20

.......................................................................................................................................................... 20

.......................................................................................................................................................... 20

37

.......................................................................................................................................................... 21

package com.xzit.entity; ......................................................................................................... 22 public class Upfile { ................................................................................................................. 22 private String fileName; //文件名称 ............................................................................. 22 private String fileStuClass;//课程班级 .................................................................................. 22 private String fileCourDate;//学年 ......................................................................................... 22 private String fileCourName;//课程名称 .............................................................................. 22 private String fileExperName;//实验名称 ............................................................................. 22 public String getFileName() { .................................................................................................. 22 return fileName; ...................................................................................................................... 22 } ................................................................................................................................................ 22 public void setFileName(String fileName) { ........................................................................... 22 this.fileName = fileName; ....................................................................................................... 22 } ................................................................................................................................................ 22 public String getFileStuClass() { .............................................................................................. 22 return fileStuClass; .................................................................................................................. 22 } ................................................................................................................................................ 23 public void setFileStuClass(String fileStuClass) { ................................................................... 23 this.fileStuClass = fileStuClass; ............................................................................................... 23 } ................................................................................................................................................ 23 public String getFileCourDate() { ............................................................................................ 23 return fileCourDate; ................................................................................................................ 23 } ................................................................................................................................................ 23 public void setFileCourDate(String fileCourDate) { ............................................................... 23

37

this.fileCourDate = fileCourDate; ........................................................................................... 23 } ................................................................................................................................................ 23 public String getFileCourName() { .......................................................................................... 23 return fileCourName; .............................................................................................................. 23 } ................................................................................................................................................ 23 public void setFileCourName(String fileCourName) { ........................................................... 23 this.fileCourName = fileCourName; ....................................................................................... 23 } ................................................................................................................................................ 23 public String getFileExperName() { ........................................................................................ 23 return fileExperName; ............................................................................................................ 23 } ................................................................................................................................................ 23 public void setFileExperName(String fileExperName) { ........................................................ 23 this.fileExperName = fileExperName; .................................................................................... 23 } ................................................................................................................................................ 23 } ................................................................................................................................................ 23 package com.xzit.dao.impl; .................................................................................................... 23 import java.sql.Connection; .................................................................................................... 23 import java.sql.PreparedStatement; ...................................................................................... 23 import java.sql.ResultSet; ....................................................................................................... 23 import java.text.SimpleDateFormat; ...................................................................................... 23 import java.util.Date; .............................................................................................................. 23 import org.apache.struts2.ServletActionContext; ................................................................ 23 import com.xzit.dao.IUpfileDao; ............................................................................................ 24 import com.xzit.entity.Upfile; ................................................................................................. 24 import com.xzit.util.DBConnection; ....................................................................................... 24 public class UpfileDao extends BaseDao implements IUpfileDao{ ........................ 24 private Connection conn=new DBConnection().getConn(); ................................................. 24 private PreparedStatement strat=null; .................................................................................. 24 public UpfileDao() throws Exception { ................................................................................... 24 super(); .................................................................................................................................... 24 } ................................................................................................................................................ 24 public Upfile QueryFileClass(String courid) throws Exception { ........................................... 24 // TODO Auto-generated method stub .................................................................................. 24 String sql = \"select * from experclasstable where CourseID='\"+courid+\"' \"; .................... 24

37

strat=conn.prepareStatement(sql); ........................................................................................ 24 ResultSet rs=strat.executeQuery(); ........................................................................................ 24 Upfile content=null; ................................................................................................................ 24 while(rs.next()){ ....................................................................................................................... 24 content=new Upfile(); ............................................................................................................. 24 content.setFileCourDate(rs.getString(\"CourseTime\"));......................................................... 24 content.setFileCourName(rs.getString(\"CourseName\")); ..................................................... 24 content.setFileStuClass(rs.getString(\"ClassName\")); ............................................................ 24 } ................................................................................................................................................ 24 return content; ........................................................................................................................ 24 } ................................................................................................................................................ 24 public String SaveFileRoad(String experid,String path,String upfilename) throws Exception {......................................................................................................................................................... 24

// TODO Auto-generated method stub .................................................................................. 25 SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");//设置日期格式 ........... 25 String datetime = df.format(new Date());// new Date()为获取当前系统时间................... 25 String

sql

=

\"update

expertablesubmit

where

set

FileRoad='\"+path+\"',Status='是

and

',UpfileDate='\"+datetime ................................................................................................................ 25

+\"',FileName='\"+upfilename+\"'

ExperimentID='\"+experid+\"'

StudentID='\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\")+\"'\"; ....... 25

strat=conn.prepareStatement(sql); ........................................................................................ 25 int n = strat.executeUpdate(); ................................................................................................ 25 if(n>0){ ..................................................................................................................................... 25 return \"success\"; ..................................................................................................................... 25 } ................................................................................................................................................ 25 return \"false\"; .......................................................................................................................... 25 } ................................................................................................................................................ 25 public String teaSaveFileRoad(String experid, String path, String courid) ........................... 25 throws Exception { .................................................................................................................. 25 // TODO Auto-generated method stub .................................................................................. 25 String

sql

=

\"update

expercontenttable

set

Templetfile='\"+path+\"'

where

ExperimentID='\"+experid+\"' and CourseID='\"+courid+\"'\"; ............................................................ 25

strat=conn.prepareStatement(sql); ........................................................................................ 25

37

int n = strat.executeUpdate(); ................................................................................................ 25 if(n>0){ ..................................................................................................................................... 25 return \"success\"; ..................................................................................................................... 25 } ................................................................................................................................................ 25 return \"false\"; .......................................................................................................................... 25 } ................................................................................................................................................ 25 } ................................................................................................................................................ 25 package com.xzit.entity; ......................................................................................................... 25 public class Experclass { .......................................................................................................... 26 private int Eid; ......................................................................................................................... 26 private String courseID; .......................................................................................................... 26 private String courseName; .................................................................................................... 26 private String courseTime; .................................................................................................. 26 private String coursePeriod;//课程学时 ................................................................................ 26 private int experimentNum; ................................................................................................... 26 private String teacherName; .................................................................................................. 26 private String className; ....................................................................................................... 26 public Experclass() { ................................................................................................................ 26 super(); .................................................................................................................................... 26 } ................................................................................................................................................ 26 public Experclass(int eid, String courseID, String courseName, ............................................ 26 String courseTime, int experimentNum, String teacherName, ............................................ 26 String className) { ................................................................................................................. 26 super(); .................................................................................................................................... 26 Eid = eid; .................................................................................................................................. 26 this.courseID = courseID; ........................................................................................................ 26 this.courseName = courseName; ........................................................................................... 26 this.courseTime = courseTime; .............................................................................................. 26 this.experimentNum = experimentNum; ............................................................................... 26 this.teacherName = teacherName; ........................................................................................ 26 this.className = className; .................................................................................................. 26 } ................................................................................................................................................ 26 public Experclass(int eid, String courseID, String courseName, ............................................ 26

37

String courseTime, String coursePeriod, int experimentNum, ............................................. 26 String teacherName, String className) { .............................................................................. 26 super(); .................................................................................................................................... 26 Eid = eid; .................................................................................................................................. 26 this.courseID = courseID; ........................................................................................................ 27 this.courseName = courseName; ........................................................................................... 27 this.courseTime = courseTime; .............................................................................................. 27 this.coursePeriod = coursePeriod; .......................................................................................... 27 this.experimentNum = experimentNum; ............................................................................... 27 this.teacherName = teacherName; ........................................................................................ 27 this.className = className; .................................................................................................. 27 } ................................................................................................................................................ 27 public String getCoursePeriod() { ........................................................................................... 27 return coursePeriod; ............................................................................................................... 27 } ................................................................................................................................................ 27 public void setCoursePeriod(String coursePeriod) { .............................................................. 27 this.coursePeriod = coursePeriod; .......................................................................................... 27 } ................................................................................................................................................ 27 public String getCourseID() { ................................................................................................... 27 return courseID; ...................................................................................................................... 27 } ................................................................................................................................................ 27 public void setCourseID(String courseID) { ............................................................................ 27 this.courseID = courseID; ........................................................................................................ 27 } ................................................................................................................................................ 27 public String getCourseName() { ............................................................................................ 27 return courseName; ................................................................................................................ 27 } ................................................................................................................................................ 27 public void setCourseName(String courseName) { ............................................................... 27 this.courseName = courseName; ........................................................................................... 27 } ................................................................................................................................................ 27 public String getCourseTime() { .............................................................................................. 27 return courseTime; ................................................................................................................. 27 } ................................................................................................................................................ 27 public void setCourseTime(String courseTime) { ................................................................... 27

37

this.courseTime = courseTime; .............................................................................................. 27 } ................................................................................................................................................ 27 public int getExperimentNum() { ............................................................................................ 28 return experimentNum; .......................................................................................................... 28 } ................................................................................................................................................ 28 public void setExperimentNum(int experimentNum) { ......................................................... 28 this.experimentNum = experimentNum; ............................................................................... 28 } ................................................................................................................................................ 28 public String getTeacherName() { ........................................................................................... 28 return teacherName; .............................................................................................................. 28 } ................................................................................................................................................ 28 public void setTeacherName(String teacherName) { ............................................................ 28 this.teacherName = teacherName; ........................................................................................ 28 } ................................................................................................................................................ 28 public String getClassName() { ............................................................................................... 28 return className; ................................................................................................................... 28 } ................................................................................................................................................ 28 public void setClassName(String className) { ...................................................................... 28 this.className = className; .................................................................................................. 28 } ................................................................................................................................................ 28 } ................................................................................................................................................ 28 package com.xzit.dao.impl; .................................................................................................... 28 import java.sql.Connection; .................................................................................................... 28 import java.sql.PreparedStatement; ...................................................................................... 28 import java.sql.ResultSet; ....................................................................................................... 28 import java.util.ArrayList; ........................................................................................................ 28 import java.util.HashMap; ...................................................................................................... 28 import java.util.List; ................................................................................................................ 28 import java.util.Map; .............................................................................................................. 28 import org.apache.struts2.ServletActionContext; ................................................................ 29 import com.xzit.dao.ExperclassDao; ...................................................................................... 29 import com.xzit.entity.ExperContent; .................................................................................... 29 import com.xzit.entity.Experclass; ......................................................................................... 29 import com.xzit.util.DBConnection; ....................................................................................... 29

37

import com.xzit.util.DataGrid; ................................................................................................ 29 public class ExperclassDaoimpl extends BaseDao implements ExperclassDao { .......................................................................................................................................................... 29

private String CourseTime; ..................................................................................................... 29 public ExperclassDaoimpl() throws Exception { ..................................................................... 29 // TODO Auto-generated constructor stub ............................................................................ 29 } ................................................................................................................................................ 29 private Connection conn=new DBConnection().getConn(); ................................................. 29 private PreparedStatement strat=null; .................................................................................. 29 public DataGrid> experclass(String coursetime) ............................... 29 throws Exception { .................................................................................................................. 29 DataGrid> dg = .................................................................................... 29 new DataGrid>(); ................................................................................ 29 //分页信息 .............................................................................................................................. 29 String _page = ServletActionContext.getRequest().getParameter(\"page\"); ........................ 29 int page = Integer.parseInt(_page==null?\"1\":_page); ........................................................... 29 String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); ........................ 29 int rows = Integer.parseInt(_rows==null?\"20\":_rows); ......................................................... 29 String sql=\"select * from experclasstable where CourseTime='\"+coursetime+\"' and TeacherID='\"+................................................................................................................................... 29

ServletActionContext.getRequest().getSession().getAttribute(\"TeaId\")+\"'\"; ....................... 30 //String

sql

=

\"select

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+ .................... 30

//ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\"; ..... 30 System.out.println(\"==============sql===========\"+sql); ............................................. 30 List> datamap = super.listMapList(sql, page,rows); .......................... 30 dg.setRows(datamap); ............................................................................................................ 30 String

countSQL

=

\"select

count(*)

from

experclasstable

where

CourseTime='\"+coursetime+\"' and TeacherID='\"+ ..................................................................... 30

ServletActionContext.getRequest().getSession().getAttribute(\"TeaId\")+\"'\"; ....................... 30 dg.setTotal(super.count(countSQL)); ...................................................................................... 30 return dg; ................................................................................................................................. 30

37

} ................................................................................................................................................ 30 public DataGrid> stuexperclass(String courseTime) throws Exception {......................................................................................................................................................... 30

// TODO Auto-generated method stub .................................................................................. 30 DataGrid> dg = .................................................................................... 30 new DataGrid>(); ................................................................................ 30 //分页信息 .............................................................................................................................. 30 String _page = ServletActionContext.getRequest().getParameter(\"page\"); ........................ 30 int page = Integer.parseInt(_page==null?\"1\":_page); ........................................................... 30 String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); ........................ 30 int rows = Integer.parseInt(_rows==null?\"20\":_rows); ......................................................... 30 //String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\"; ............. 30

String

sql

=

\"select

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+ .................... 31

ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\"; ........ 31 List> datamap = super.listMapList(sql, page,rows); .......................... 31 dg.setRows(datamap); ............................................................................................................ 31 String

countSQL

=

\"select

count(*)

from

experclasstable

where

CourseTime='\"+courseTime+\"' and ClassName='\"+ ................................................................... 31

ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\"; ........ 31 dg.setTotal(super.count(countSQL)); ...................................................................................... 31 return dg; ................................................................................................................................. 31 } ................................................................................................................................................ 31 public DataGrid> stuexperContentlist(String courseId) throws Exception { ....................................................................................................................................... 31

// TODO Auto-generated method stub .................................................................................. 31 DataGrid> dg = .................................................................................... 31 new DataGrid>(); ................................................................................ 31 //分页信息 .............................................................................................................................. 31 String _page = ServletActionContext.getRequest().getParameter(\"page\"); ........................ 31 int page = Integer.parseInt(_page==null?\"1\":_page); ........................................................... 31

37

String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); ........................ 31 int rows = Integer.parseInt(_rows==null?\"20\":_rows); ......................................................... 31 //String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\"; ............. 31

String

sql

=

\"select

t1.ExperimentID,t1.ExperimentName,ExperimentPeriod,t1.TeacherName,t2.Status,t2.upfileDate,t1.ExperimentContent from expercontenttable as t1 join expertablesubmit as t2 on t1.ExperimentID=t2.ExperimentID where t1.CourseID='\" ............................................................. 31

+courseId+\"'

and

StudentID=\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\"); .............. 32

List> datamap = super.listMapList(sql, page,rows); .......................... 32 dg.setRows(datamap); ............................................................................................................ 32 String countSQL = \"select count(*) from expercontenttable as t1 join expertablesubmit as t2

on

t1.ExperimentID=t2.ExperimentID

where

t1.CourseID='\"+courseId+\"'

and

StudentID=\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\"); .............. 32

dg.setTotal(super.count(countSQL)); ...................................................................................... 32 return dg; ................................................................................................................................. 32 } ................................................................................................................................................ 32 public ExperContent queryExperContent(String experimentID) throws Exception { .......... 32 // TODO Auto-generated method stub .................................................................................. 32 String sql = \"select t1.* from expercontenttable as t1 join expertablesubmit as t2 on t1.CourseID=t2.CourseID

where

t1.ExperimentID='\"+experimentID+\"'

and

StudentID='\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\")+\"'\"; ....... 32

System.out.println(sql); .......................................................................................................... 32 strat=conn.prepareStatement(sql); ........................................................................................ 32 ResultSet rs=strat.executeQuery(); ........................................................................................ 32 ExperContent content=null; ................................................................................................... 32 if(rs.next()){ .............................................................................................................................. 32 content=new ExperContent(); ................................................................................................ 32 content.setExperimentID(rs.getString(\"ExperimentID\")); ..................................................... 32 content.setExperimentName(rs.getString(\"ExperimentName\")); ........................................ 32 content.setExperimentContent(rs.getString(\"ExperimentContent\")); ................................. 32 content.setExperimentPeriod(rs.getInt(\"ExperimentPeriod\")); ........................................... 32

37

content.setTeacherName(rs.getString(\"TeacherName\")); .................................................... 32 //content.setTempletfile(rs.getString(\"Templetfile\")); .......................................................... 32 content.setTempletfile(\"upload/\"+rs.getString(\"Templetfile\").replace(\"\\\\\.............. 33 } ................................................................................................................................................ 33 return content; ........................................................................................................................ 33 } ................................................................................................................................................ 33 public DataGrid> getexperlist(String courseId) throws Exception { . 33 // TODO Auto-generated method stub .................................................................................. 33 DataGrid> dg = .................................................................................... 33 new DataGrid>(); ................................................................................ 33 //分页信息 .............................................................................................................................. 33 String _page = ServletActionContext.getRequest().getParameter(\"page\"); ........................ 33 int page = Integer.parseInt(_page==null?\"1\":_page); ........................................................... 33 String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); ........................ 33 int rows = Integer.parseInt(_rows==null?\"20\":_rows); ......................................................... 33 //String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\"; ............. 33

String sql = \"select * from expercontenttable where CourseID='\" .................................... 33 +courseId+\"'\"; .......................................................................................................................... 33 List> datamap = super.listMapList(sql, page,rows); .......................... 33 dg.setRows(datamap); ............................................................................................................ 33 String countSQL = \"select count(*) from expercontenttable where CourseID='\" ................ 33 +courseId+\"'\"; .......................................................................................................................... 33 dg.setTotal(super.count(countSQL)); ...................................................................................... 33 return dg; ................................................................................................................................. 33 } ................................................................................................................................................ 33 public String getCourseTime() { .............................................................................................. 33 return CourseTime; ................................................................................................................. 34 } ................................................................................................................................................ 34 public void setCourseTime(String courseTime) { ................................................................... 34 CourseTime = courseTime; ..................................................................................................... 34 } ................................................................................................................................................ 34 }结论 ........................................................................................................................................ 34

37

1 绪论

1.1开发背景

实验教学是学生技能培养的重要环节之一,学生实验报告的质量在一定程度上反

映了实验教学的质量,实验报告管理水平也反映了实验教学管理水平。目前,大部分学校所提交的实验报告大多还停留在以纸为介质的方式上,这将严重制约着实验教学的开展。首先,很多课程的实验结果在纸质实验报告中不能表现或不能完全表现,其次纸质实验报告的批改和分析也是实验授课老师的一个很重负担,如何提高学生实验报告的表象能力,提高教师批改实验报告的效率并及时发现和纠正实验报告中存在的问题是许多课程实验授课教师所面对的一个难题。

1.2 本次设计完成的工作

老师登录该系统可以上传、下载实验报告、查看学生做的实验报告并给学生打分、老师可以查看实验验课程、实验课程列表、查看实验提交情况等。

学生登录该系统可以上传、下载实验报告、查看实验课程和实验课程列表。

1.3 任务分工

组织结构:为了完成学生信息管理系统的项目开发,班级组成了一个项目团队,人员分工:为了明确项目团队中每个人的任务分工,现制定人员分工,如下表2.1所示:

表2.1 人员分工 成 角色 负责的模块内容 员 A 江灵瞳 学生的上传,下载,学生查看实验课程,查看实验列表 老师的上传,下载,和老师填写分数,数据库设B 印海平 计 C 钱晨晨 老师查看实验课程,查看实验列表,查看实验上交情况,登录 1.4 任务

我们三个人各自分工完成自己的模块内容,首先,江灵瞳构造整个系统的框架,然后印海平设计数据库,在我们一起先设计前台界面,之后我们就各自实现各自模块的功能。

37

37

2 系统分析

2.1需求分析

1)实验课程设置,设置课程编号、课程名、时间、次数、老师编号、老师名、实验班级;

2)实验列表设置,设置实验编号、实验名、班级、学生学号、学生名、老师名、实验路径、提交状态、分数;

3)树型类别设置,设置编号、名字、路径、学生名、老师名、树的状态。

2.2可行性分析

2.2.1引言

编写目的: 背景:

徐州工程学院是一所培养应用型人才的普通高等学院。为了完善管理学校实验报告太多没有地方保存了,经决定开发实验报告管理系统。

2.2.2可行性研究的前提

要求:

实验报告系统必须提供学生信息和教师信息的基础设置;提供强大的条件搜索功能个实验课程查询、实验列表出现等管理功能;可以分不同权限、不同用户对该系统进行操作。另外,该系统还必须保证数据的安全性、完整性和准确性。

目标:

实验报告管理系统的目标是实现学生的纸质的实验报告太多没有地方长期保存,这样用一个系统可以将一个课程所有学生的实验报告进行管理方便存放。

条件、假定和:

时间的,我们必须在两周的时间里完成项目,在这期间系统分析员需要整理好分析结果,分配各组员的任务,每天需要人员跟踪记录整理文档。程序开发人员须在5天的时间里进行系统设计、程序编码、系统测试、程序调试。期间,还包括一个双休日假期。

2.2.3结论

根据上面的分析,在技术上不会存在什么问题,因此项目延期的可能性很小。只要在分配的时间里都能顺利地完成任务,再加上团队的凝聚力齐心协力,相信在这两周内会获得一个满意的结果。

2.3 用例图

37

登录下载实验老师学生查看提交情况上传实验打分查看实验列表查看实验课程图2.1 用例图

37

上传实验报告下载实验报告

3 系统设计与实现

3.1系统目标

根据需求分析的描述以及与组建成员的沟通,现制定系统实现目标如下: a.界面设计简洁、友好、美观大方。 b.操作简单、快捷方便。 c.数据存储安全、可靠。 d.信息分类清晰、准确。

e.强大的查询功能,保证数据查询的灵活性。 f.为管理员提供真实的数据信息。

g.对用户输入的数据,系统进行严格的数据检查,尽可能排除认为的错误。

3.2系统功能结构

图3.1 系统功能结构

3.3功能流程及工作流程

学生模块: a.查看实验课程

系统操作人员打开学生模块主界面,输入相关的信息(学号、密码)进入模块,点击学年按钮就可以看到所需要的信息。

b.查看实验列表

37

系统操作人员打开学生模块主界面,输入相关信息进入模块,点击课程就可以看到所要的信息。

c.下载实验报告模板

当该学生进入自己的界面时,找到要做实验报告的课程,点击下载按钮。 d.上传实验报告

当学生做完实验报告后,进入系统,点击上传按钮。 教师模块: a.查看实验课程

系统操作人员打开学生模块主界面,输入相关的信息(工号、密码)进入模块,点击学年按钮就可以看到所需要的信息。

b.查看实验列表

系统操作人员打开老师模块主界面,输入相关信息进入模块,点击课程就可以看到所要的信息

c.查看提交情况

教师进入教师界面,点击自己教的课程,点击查看按钮。 d.上传实验报告模板

当该老师进入自己的界面时,找到要做实验报告的课程的实验名称,点击上传按钮。 e.下载学生实验

当该老师进入自己的界面时,找到实验列表详情,点击下载按钮。 f.打分

当该老师进入自己的界面时,下载学生的实验报告看完后,在实验列表详情中点击打分按钮。

3.4系统流程图

图3.2 系统流程图

3.5构建开发环境

a.操作系统:windows 7或XP b.java开发包:JDK1.6

37

c.数据库:MY SQL

d.分辨率:最佳效果为1024*768像素

3.7文件夹组织结构

图3.7 文件夹组织结构

3.8 学生模块的实现

37

package com.xzit.entity;

public class Experclass {

private int Eid; private String courseID; private String courseName; private String courseTime;

private String coursePeriod;//课程学时

private int experimentNum;

37

private String teacherName; private String className;

public Experclass() { }

super();

public Experclass(int eid, String courseID, String courseName,

String courseTime, int experimentNum, String teacherName, String className) {

super(); Eid = eid;

this.courseID = courseID; this.courseName = courseName; this.courseTime = courseTime; this.experimentNum = experimentNum; this.teacherName = teacherName; this.className = className;

}

public Experclass(int eid, String courseID, String courseName,

public String getCoursePeriod() { }

public void setCoursePeriod(String coursePeriod) { }

37

String courseTime, String coursePeriod, int experimentNum, String teacherName, String className) {

super(); Eid = eid;

this.courseID = courseID; this.courseName = courseName; this.courseTime = courseTime; this.coursePeriod = coursePeriod; this.experimentNum = experimentNum; this.teacherName = teacherName; this.className = className;

}

return coursePeriod;

this.coursePeriod = coursePeriod;

public String getCourseID() { return courseID;

}

public void setCourseID(String courseID) { this.courseID = courseID; }

public String getCourseName() { return courseName; }

public void setCourseName(String courseName) { this.courseName = courseName; }

public String getCourseTime() { return courseTime;

}

public void setCourseTime(String courseTime) { this.courseTime = courseTime; }

public int getExperimentNum() { return experimentNum; }

public void setExperimentNum(int experimentNum) { this.experimentNum = experimentNum; }

public String getTeacherName() { return teacherName;

}

public void setTeacherName(String teacherName) { this.teacherName = teacherName; }

public String getClassName() { return className;

}

public void setClassName(String className) { this.className = className; }

}

package com.xzit.dao.impl;

37

import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet;

import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.xzit.dao.ExperclassDao; import com.xzit.entity.ExperContent; import com.xzit.entity.Experclass; import com.xzit.util.DBConnection; import com.xzit.util.DataGrid;

public class ExperclassDaoimpl extends BaseDao implements ExperclassDao {

private String CourseTime;

public ExperclassDaoimpl() throws Exception { }

private Connection conn=new DBConnection().getConn(); private PreparedStatement strat=null;

public DataGrid> experclass(String coursetime)

throws Exception {

DataGrid> dg =

new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\"); int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); int rows = Integer.parseInt(_rows==null?\"20\":_rows);

String sql=\"select * from experclasstable where CourseTime='\"+coursetime+\"' and TeacherID='\"+

ServletActionContext.getRequest().getSession().getAttribute(\"TeaId\")+\"'\";

//String sql = \"select

37

// TODO Auto-generated constructor stub

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+

public DataGrid> stuexperclass(String courseTime) throws Exception {

// TODO Auto-generated method stub

DataGrid> dg =

new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\"); int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); int rows = Integer.parseInt(_rows==null?\"20\":_rows);

//String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from String sql = \"select

}

//ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\"; System.out.println(\"==============sql===========\"+sql);

List> datamap = super.listMapList(sql, page,rows); dg.setRows(datamap);

String countSQL = \"select count(*) from experclasstable where

ServletActionContext.getRequest().getSession().getAttribute(\"TeaId\")+\"'\"; dg.setTotal(super.count(countSQL)); return dg;

CourseTime='\"+coursetime+\"' and TeacherID='\"+

experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\";

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+

}

ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\";

List> datamap = super.listMapList(sql, page,rows); dg.setRows(datamap);

String countSQL = \"select count(*) from experclasstable where CourseTime='\"+courseTime+\"'

ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\";

and ClassName='\"+

dg.setTotal(super.count(countSQL)); return dg;

37

public DataGrid> stuexperContentlist(String courseId) throws Exception {

// TODO Auto-generated method stub

DataGrid> dg =

new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\"); int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); int rows = Integer.parseInt(_rows==null?\"20\":_rows);

//String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from experclasstable String sql = \"select

where CourseTime='2014年-2015年' and ClassName='12计卓'\";

t1.ExperimentID,t1.ExperimentName,ExperimentPeriod,t1.TeacherName,t2.Status,t2.upfileDate,t1.ExperimentContent from expercontenttable as t1 join expertablesubmit as t2 on t1.ExperimentID=t2.ExperimentID where t1.CourseID='\"

List> datamap = super.listMapList(sql, page,rows); dg.setRows(datamap);

String countSQL = \"select count(*) from expercontenttable as t1 join expertablesubmit as t2 on +courseId+\"' and StudentID=\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\");

t1.ExperimentID=t2.ExperimentID where t1.CourseID='\"+courseId+\"' and

StudentID=\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\");

}

public ExperContent queryExperContent(String experimentID) throws Exception {

// TODO Auto-generated method stub

String sql = \"select t1.* from expercontenttable as t1 join expertablesubmit as t2 on dg.setTotal(super.count(countSQL)); return dg;

t1.CourseID=t2.CourseID where t1.ExperimentID='\"+experimentID+\"' and

StudentID='\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\")+\"'\";

System.out.println(sql);

strat=conn.prepareStatement(sql);

ResultSet rs=strat.executeQuery(); ExperContent content=null;

if(rs.next()){

content=new ExperContent();

content.setExperimentID(rs.getString(\"ExperimentID\"));

37

}

content.setExperimentName(rs.getString(\"ExperimentName\")); content.setExperimentContent(rs.getString(\"ExperimentContent\")); content.setExperimentPeriod(rs.getInt(\"ExperimentPeriod\")); content.setTeacherName(rs.getString(\"TeacherName\")); //content.setTempletfile(rs.getString(\"Templetfile\"));

content.setTempletfile(\"upload/\"+rs.getString(\"Templetfile\").replace(\"\\\\\

return content;

public DataGrid> getexperlist(String courseId) throws Exception { }

public String getCourseTime() { }

public void setCourseTime(String courseTime) {

CourseTime = courseTime;

37

}

// TODO Auto-generated method stub DataGrid> dg =

new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\"); int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); int rows = Integer.parseInt(_rows==null?\"20\":_rows);

//String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from experclasstable String sql = \"select * from expercontenttable where CourseID='\" +courseId+\"'\";

List> datamap = super.listMapList(sql, page,rows); dg.setRows(datamap);

String countSQL = \"select count(*) from expercontenttable where CourseID='\" +courseId+\"'\";

dg.setTotal(super.count(countSQL)); return dg;

where CourseTime='2014年-2015年' and ClassName='12计卓'\";

return CourseTime;

}

}

package com.xzit.entity;

public class Exper { private String ExperimentID; private String ExperimentName; private String ClassName; private String StudentID;

private String StudentName; private String TeacherID; private String TeacherName; private String FileName; private String FileRoad; private String Status; private String UpfileDate; private String Testscore;

public Exper() { }

public Exper(String experimentID, String experimentName, }

37

super();

String studentName, String teacherName, String fileRoad, String status) {

super();

ExperimentID = experimentID; ExperimentName = experimentName; StudentName = studentName; TeacherName = teacherName; FileRoad = fileRoad; Status = status;

public Exper(String experimentID, String experimentName, String className,

String studentID, String studentName, String teacherID, String teacherName, String fileName, String fileRoad, String status, String upfileDate, String testscore) {

super();

ExperimentID = experimentID; ExperimentName = experimentName; ClassName = className; StudentID = studentID; StudentName = studentName; TeacherID = teacherID; TeacherName = teacherName; FileName = fileName; FileRoad = fileRoad; Status = status; UpfileDate = upfileDate; Testscore = testscore;

} public String getClassName() { return ClassName;

} public void setClassName(String className) { ClassName = className;

} public String getStudentID() { return StudentID;

} public void setStudentID(String studentID) { StudentID = studentID;

} public String getTeacherID() { return TeacherID;

} public void setTeacherID(String teacherID) {

TeacherID = teacherID;

37

}

public String getFileName() { }

public void setFileName(String fileName) { }

public String getUpfileDate() { }

public void setUpfileDate(String upfileDate) { }

public String getTestscore() { }

public void setTestscore(String testscore) { }

public String getExperimentID() { }

public void setExperimentID(String experimentID) { }

public String getExperimentName() { }

public void setExperimentName(String experimentName) { }

public String getStudentName() {

37

return FileName;

FileName = fileName;

return UpfileDate;

UpfileDate = upfileDate;

return Testscore;

Testscore = testscore;

return ExperimentID;

ExperimentID = experimentID;

return ExperimentName;

ExperimentName = experimentName;

return StudentName;

}

public void setStudentName(String studentName) { StudentName = studentName;

}

public String getTeacherName() { return TeacherName;

}

public void setTeacherName(String teacherName) { TeacherName = teacherName;

}

public String getFileRoad() { return FileRoad;

}

public void setFileRoad(String fileRoad) { FileRoad = fileRoad;

}

public String getStatus() { return Status;

}

public void setStatus(String status) { Status = status;

}

}

package com.xzit.dao.impl;

import java.sql.Connection; import java.sql.PreparedStatement; import java.util.List; import java.util.Map;

import org.apache.struts2.ServletActionContext;

37

import com.xzit.dao.ExperDao; import com.xzit.entity.Exper; import com.xzit.util.DBConnection; import com.xzit.util.DataGrid;

public class ExperDaoListImpl extends BaseDao implements ExperDao {

private Connection conn =new DBConnection().getConn(); private PreparedStatement strat=null;

public ExperDaoListImpl() throws Exception { }

public Exper exper() throws Exception { }

public void saveandUpdate(int sid, int eid) throws Exception {

}

public List list(int page, int rows) throws Exception { }

public long count() throws Exception { }

public DataGrid> getexpsublist(String experid,String courid)

throws Exception {

// TODO Auto-generated method stub

DataGrid> dg =

new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\");

37

super();

// TODO Auto-generated constructor stub

// TODO Auto-generated method stub return null;

// TODO Auto-generated method stub

String sql=\"select * from expertablesubmit\"; return super.list(sql, Exper.class, page, rows);

return 0;

int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\"); int rows = Integer.parseInt(_rows==null?\"20\":_rows);

String sql=\"select * from expertablesubmit where ExperimentID='\"+experid+\"' and CourseID='\"+

courid+\"'\";

sql

=

\"select from

//String

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+

}

public boolean addfron(String experid, String courid, String stuid, }

}

package com.xzit.entity;

public class Upfile {

private String fileName; //文件名称 private String fileStuClass;//课程班级

37

//ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\";

System.out.println(\"==============sql===========\"+sql);

List> datamap = super.listMapList(sql, page,rows); dg.setRows(datamap); String

countSQL

=

\"select

count(*)

from

expertablesubmit

where

ExperimentID='\"+experid+\"' and CourseID='\"+

courid+\"'\";

dg.setTotal(super.count(countSQL)); return dg;

float Testscores) throws Exception {

sql

=

\"update

expertablesubmit

set

Testscore=\"+Testscores+\"

where

// TODO Auto-generated method stub String

ExperimentID='\"+experid+\"' and StudentID='\"+stuid+\"' and CourseID ='\"+courid+\"'\";

strat=conn.prepareStatement(sql); int n = strat.executeUpdate(); if(n>0){ }

return false;

return true;

private String fileCourDate;//学年 private String fileCourName;//课程名称 private String fileExperName;//实验名称

public String getFileName() { }

public void setFileName(String fileName) { }

public String getFileStuClass() { }

public void setFileStuClass(String fileStuClass) { }

public String getFileCourDate() { }

public void setFileCourDate(String fileCourDate) { }

public String getFileCourName() { }

public void setFileCourName(String fileCourName) { }

public String getFileExperName() { }

public void setFileExperName(String fileExperName) { }

}

this.fileExperName = fileExperName; return fileExperName;

this.fileCourName = fileCourName; return fileCourName;

this.fileCourDate = fileCourDate; return fileCourDate; this.fileStuClass = fileStuClass; return fileStuClass; this.fileName = fileName; return fileName;

package com.xzit.dao.impl;

import java.sql.Connection; import java.sql.PreparedStatement;

37

import java.sql.ResultSet;

import java.text.SimpleDateFormat; import java.util.Date;

import org.apache.struts2.ServletActionContext;

import com.xzit.dao.IUpfileDao; import com.xzit.entity.Upfile; import com.xzit.util.DBConnection;

public class UpfileDao extends BaseDao implements IUpfileDao{

private Connection conn=new DBConnection().getConn(); private PreparedStatement strat=null;

public UpfileDao() throws Exception {

public Upfile QueryFileClass(String courid) throws Exception {

// TODO Auto-generated method stub

String sql = \"select * from experclasstable where CourseID='\"+courid+\"' \"; strat=conn.prepareStatement(sql); }

super();

ResultSet rs=strat.executeQuery(); Upfile content=null; while(rs.next()){ }

return content;

}

public String SaveFileRoad(String experid,String path,String upfilename) throws Exception {

// TODO Auto-generated method stub

SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");//设置日期格式 String datetime = df.format(new Date());// new Date()为获取当前系统时间

String sql = \"update expertablesubmit set FileRoad='\"+path+\"',Status='是',UpfileDate='\"+datetime

37

content=new Upfile();

content.setFileCourDate(rs.getString(\"CourseTime\")); content.setFileCourName(rs.getString(\"CourseName\")); content.setFileStuClass(rs.getString(\"ClassName\"));

}

+\"',FileName='\"+upfilename+\"' where ExperimentID='\"+experid+\"' and

StudentID='\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\")+\"'\";

strat=conn.prepareStatement(sql); int n = strat.executeUpdate(); if(n>0){ }

return \"false\";

return \"success\";

public String teaSaveFileRoad(String experid, String path, String courid) }

}

throws Exception {

// TODO Auto-generated method stub

String sql = \"update expercontenttable set Templetfile='\"+path+\"' where ExperimentID='\"+experid+\"' strat=conn.prepareStatement(sql); int n = strat.executeUpdate(); if(n>0){ }

return \"false\";

return \"success\";

and CourseID='\"+courid+\"'\";

3.9 老师模块的实现

37

package com.xzit.entity;

public class ExperContent {

37

private String ExperimentID; private String ExperimentName; private String ExperimentContent; private int ExperimentPeriod;

private String TeacherName; private String Templetfile; public String getExperimentID() { }

public void setExperimentID(String experimentID) { }

public String getExperimentName() { }

public void setExperimentName(String experimentName) { }

public String getExperimentContent() { }

public void setExperimentContent(String experimentContent) { }

public int getExperimentPeriod() { }

public void setExperimentPeriod(int experimentPeriod) { }

public String getTeacherName() { }

public void setTeacherName(String teacherName) { }

public String getTempletfile() { }

public void setTempletfile(String templetfile) {

37

return ExperimentID;

ExperimentID = experimentID;

return ExperimentName;

ExperimentName = experimentName;

return ExperimentContent;

ExperimentContent = experimentContent;

return ExperimentPeriod;

ExperimentPeriod = experimentPeriod;

return TeacherName;

TeacherName = teacherName;

return Templetfile;

}

Templetfile = templetfile;

public ExperContent() { }

public ExperContent(String experimentID, String experimentName, }

String experimentContent, int experimentPeriod, String teacherName, String templetfile) { super();

super();

ExperimentID = experimentID; ExperimentName = experimentName; ExperimentContent = experimentContent; ExperimentPeriod = experimentPeriod; TeacherName = teacherName; Templetfile = templetfile;

}

package com.xzit.entity;

public class Upfile {

private String fileName; //文件名称 private String fileStuClass;//课程班级 private String fileCourDate;//学年 private String fileCourName;//课程名称 private String fileExperName;//实验名称

public String getFileName() {

return fileName;

}

public void setFileName(String fileName) {

this.fileName = fileName;

37

}

public String getFileStuClass() {

return fileStuClass;

}

public void setFileStuClass(String fileStuClass) {

this.fileStuClass = fileStuClass;

}

public String getFileCourDate() {

return fileCourDate;

}

public void setFileCourDate(String fileCourDate) {

this.fileCourDate = fileCourDate;

}

public String getFileCourName() {

return fileCourName;

}

public void setFileCourName(String fileCourName) {

this.fileCourName = fileCourName;

}

public String getFileExperName() {

return fileExperName;

}

public void setFileExperName(String fileExperName) {

this.fileExperName = fileExperName;

}

37

}

package com.xzit.dao.impl;

import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.text.SimpleDateFormat;

import java.util.Date;

import org.apache.struts2.ServletActionContext;

import com.xzit.dao.IUpfileDao; import com.xzit.entity.Upfile; import com.xzit.util.DBConnection;

public class UpfileDao extends BaseDao implements IUpfileDao{

private Connection conn=new DBConnection().getConn();

private PreparedStatement strat=null;

public UpfileDao() throws Exception {

super(); }

public Upfile QueryFileClass(String courid) throws Exception {

// TODO Auto-generated method stub

String sql = \"select * from experclasstable where CourseID='\"+courid+\"' \";

strat=conn.prepareStatement(sql);

37

ResultSet rs=strat.executeQuery();

Upfile content=null; while(rs.next()){ content=new Upfile();

content.setFileCourDate(rs.getString(\"CourseTime\")); content.setFileCourName(rs.getString(\"CourseName\")); content.setFileStuClass(rs.getString(\"ClassName\"));

}

return content;

public String SaveFileRoad(String experid,String path,String upfilename) throws

Exception {

// TODO Auto-generated method stub

}

SimpleDateFormat df = new SimpleDateFormat(\"yyyy-MM-dd\");//设置日期格式 String datetime = df.format(new Date());// new Date()为获取当前系统时间 String sql = \"update expertablesubmit set FileRoad='\"+path+\"',Status='是

',UpfileDate='\"+datetime

+\"',FileName='\"+upfilename+\"' where ExperimentID='\"+experid+\"' and

StudentID='\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\")+\"'\";

strat=conn.prepareStatement(sql); int n = strat.executeUpdate();

if(n>0){ return \"success\";

}

return \"false\";

}

37

public String teaSaveFileRoad(String experid, String path, String courid)

throws Exception {

// TODO Auto-generated method stub

String sql = \"update expercontenttable set Templetfile='\"+path+\"' where ExperimentID='\"+experid+\"' and CourseID='\"+courid+\"'\";

strat=conn.prepareStatement(sql); int n = strat.executeUpdate();

if(n>0){ return \"success\";

}

return \"false\"; } }

package com.xzit.entity;

public class Experclass {

private int Eid;

private String courseID; private String courseName; private String courseTime;

private String coursePeriod;//课程学时

private int experimentNum; private String teacherName;

37

private String className;

public Experclass() {

super(); }

public Experclass(int eid, String courseID, String courseName,

String courseTime, int experimentNum, String teacherName,

String className) { super(); Eid = eid;

this.courseID = courseID; this.courseName = courseName; this.courseTime = courseTime;

this.experimentNum = experimentNum; this.teacherName = teacherName; this.className = className;

}

public Experclass(int eid, String courseID, String courseName,

String courseTime, String coursePeriod, int experimentNum,

String teacherName, String className) {

super(); Eid = eid;

this.courseID = courseID; this.courseName = courseName; this.courseTime = courseTime; this.coursePeriod = coursePeriod;

37

this.experimentNum = experimentNum; this.teacherName = teacherName; this.className = className;

public String getCoursePeriod() {

return coursePeriod; } }

public void setCoursePeriod(String coursePeriod) {

this.coursePeriod = coursePeriod;

}

public String getCourseID() {

return courseID;

}

public void setCourseID(String courseID) {

this.courseID = courseID;

}

public String getCourseName() {

return courseName;

}

public void setCourseName(String courseName) {

this.courseName = courseName;

}

public String getCourseTime() {

return courseTime;

}

public void setCourseTime(String courseTime) {

37

this.courseTime = courseTime;

}

public int getExperimentNum() {

return experimentNum;

}

public void setExperimentNum(int experimentNum) {

this.experimentNum = experimentNum;

}

public String getTeacherName() {

return teacherName;

}

public void setTeacherName(String teacherName) {

this.teacherName = teacherName;

}

public String getClassName() {

return className;

}

public void setClassName(String className) {

this.className = className;

}

package com.xzit.dao.impl;

37

}

import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.xzit.dao.ExperclassDao; import com.xzit.entity.ExperContent; import com.xzit.entity.Experclass; import com.xzit.util.DBConnection; import com.xzit.util.DataGrid;

public class ExperclassDaoimpl extends BaseDao implements ExperclassDao {

private String CourseTime;

public ExperclassDaoimpl() throws Exception {

// TODO Auto-generated constructor stub

}

private Connection conn=new DBConnection().getConn();

private PreparedStatement strat=null;

public DataGrid> experclass(String coursetime)

throws Exception {

37

DataGrid> dg = new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\");

int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\");

int rows = Integer.parseInt(_rows==null?\"20\":_rows);

String sql=\"select * from experclasstable where CourseTime='\"+coursetime+\"' and

TeacherID='\"+

ServletActionContext.getRequest().getSession().getAttribute(\"TeaId\")+\"'\";

//String sql = \"select

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName

from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+

//ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\";

System.out.println(\"==============sql===========\"+sql);

List> datamap = super.listMapList(sql, page,rows);

dg.setRows(datamap);

String countSQL = \"select count(*) from experclasstable where

CourseTime='\"+coursetime+\"' and TeacherID='\"+

ServletActionContext.getRequest().getSession().getAttribute(\"TeaId\")+\"'\";

dg.setTotal(super.count(countSQL)); }

return dg;

37

public DataGrid> stuexperclass(String courseTime) throws

Exception {

// TODO Auto-generated method stub

DataGrid> dg = new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\");

int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\");

int rows = Integer.parseInt(_rows==null?\"20\":_rows);

//String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName

from experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\";

String sql = \"select

CourseID,CourseName,CourseTime,CoursePeriod,ExperimentNum,TeacherName,ClassName

from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+

ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\";

List> datamap = super.listMapList(sql, page,rows);

dg.setRows(datamap);

String countSQL = \"select count(*) from experclasstable where CourseTime='\"+courseTime+\"' and ClassName='\"+

ServletActionContext.getRequest().getSession().getAttribute(\"userclassname\")+\"'\";

dg.setTotal(super.count(countSQL));

return dg;

37

}

public DataGrid> stuexperContentlist(String courseId) throws

Exception {

// TODO Auto-generated method stub

DataGrid> dg = new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\");

int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\");

int rows = Integer.parseInt(_rows==null?\"20\":_rows);

//String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from

experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\";

String sql = \"select

t1.ExperimentID,t1.ExperimentName,ExperimentPeriod,t1.TeacherName,t2.Status,t2.upfileDate,t

1.ExperimentContent from expercontenttable as t1 join expertablesubmit as t2 on

t1.ExperimentID=t2.ExperimentID where t1.CourseID='\"

+courseId+\"' and

StudentID=\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\");

List> datamap = super.listMapList(sql, page,rows);

dg.setRows(datamap);

String countSQL = \"select count(*) from expercontenttable as t1 join

expertablesubmit as t2 on t1.ExperimentID=t2.ExperimentID where t1.CourseID='\"+courseId+\"' and StudentID=\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\");

dg.setTotal(super.count(countSQL));

return dg; }

37

public ExperContent queryExperContent(String experimentID) throws Exception {

// TODO Auto-generated method stub

String sql = \"select t1.* from expercontenttable as t1 join expertablesubmit as t2 on t1.CourseID=t2.CourseID where t1.ExperimentID='\"+experimentID+\"' and

StudentID='\"+ServletActionContext.getRequest().getSession().getAttribute(\"userId\")+\"'\";

System.out.println(sql); strat=conn.prepareStatement(sql);

ResultSet rs=strat.executeQuery(); ExperContent content=null;

if(rs.next()){

content=new ExperContent();

content.setExperimentID(rs.getString(\"ExperimentID\")); content.setExperimentName(rs.getString(\"ExperimentName\")); content.setExperimentContent(rs.getString(\"ExperimentContent\")); content.setExperimentPeriod(rs.getInt(\"ExperimentPeriod\")); content.setTeacherName(rs.getString(\"TeacherName\")); //content.setTempletfile(rs.getString(\"Templetfile\"));

content.setTempletfile(\"upload/\"+rs.getString(\"Templetfile\").replace(\"\\\\\

}

return content;

public DataGrid> getexperlist(String courseId) throws Exception {

// TODO Auto-generated method stub

37

}

DataGrid> dg = new DataGrid>();

//分页信息

String _page = ServletActionContext.getRequest().getParameter(\"page\");

int page = Integer.parseInt(_page==null?\"1\":_page);

String _rows = ServletActionContext.getRequest().getParameter(\"rows\");

int rows = Integer.parseInt(_rows==null?\"20\":_rows);

//String sql = \"select CourseID,CourseName,ExperimentNum,TeacherName from

experclasstable where CourseTime='2014年-2015年' and ClassName='12计卓'\";

String sql = \"select * from expercontenttable where CourseID='\"

+courseId+\"'\";

List> datamap = super.listMapList(sql, page,rows);

dg.setRows(datamap);

String countSQL = \"select count(*) from expercontenttable where CourseID='\"

+courseId+\"'\";

dg.setTotal(super.count(countSQL));

return dg; }

public String getCourseTime() {

return CourseTime; }

public void setCourseTime(String courseTime) {

CourseTime = courseTime;

}

37

}

37

结论

我们学习了html5,css,javascript以及java ee 中的jsp,servlet,过滤器,,JSTL,EL,jQuery,Ajax。

下面就各个模块进行总结:在学习html时,我是对这个没太在意的,因为里面全部是标签,没有需要理解的内容,全部是属于识记的,所以在学习时相对轻松,对于html常用的标签都是非常清楚的form中的十一种类型,常用的有text,password,hidden,submit,button,radio,checkbox,等其他的标签如div,table,span,select都是重要的标签.

Css的学习:虽然说在标签中也可以定义样式,但是这么做看起来不是那么明智,我在学CSS时还是比较努力的,所有的样式效果都测试过,并且写了相应的案例,只是过了不到3个月就忘了一大半,很多时候都是查文档才能写出来的,虽然CSS对于我们来说不必要非常精通,但是我觉得掌握的东西越多,以后的工作就越轻松,所以在考试结束后也会去看看前面的笔记和案例。

Javascript:js 我认为是最重要的,甚至于超过servlet,jsp,在上课期间,讲的内容还是比较少的,就javascript中创建对象来说吧,应该只讲过3中方法,虽然在一般的情况下是用不上的,但是我觉得还是有必要学习的,这样有助于看懂别人写的框架,在javascript这部分学习中讲的最多的还是dom操作,不过我觉得用dom操作太繁琐了,写的代码太多,而且效率看起来也不高,后面就是讲的事件,事件也算是简单的,只是对触发的事件进行相应的响应。除了这些就是javascript流程控制,对象一些基本语法,这些和java类似,所以在上课时没有讲得太多。

Servlet:我觉得是比较简单的,可能是因为它是java代码,容易理解。首先讲的是开发环境的配置,安装tomcat,了解tomcat下的目录,以及web工程下的目录。后来是讲了servlet的访问方式,post和get的区别,处理中文乱码是servlet中一个重要的知识点,几乎每个项目都会遇到这个问题。主要乱码有get,post乱码,是通过设置request或者response的编码方式来实现的。Servlet间的跳转方式有重定向和转发,对于重定向和转发的区别,现在理解的很透彻了,重定向是不能获取request中参数,是客户端的两次请求,而转发是服务器内部跳转,不过,两种在设置过滤器的情况下,都要通过过滤器才能跳转。Servlet的生命周期是笔试的必考题,其实这是很简单的,只需要理解,没必要死记硬背的,session算是重要的知识点,很多数据都是存储在内存中,如购物车,用户信息等,还可以对session设置生存时间。说到session就必须说说四种会话跟踪技术,cookie,URL重写,表单域隐藏和session。

JSP:JSP实际上和servlet是一样的,只不过两者侧重点不同,JSP的内置对象和作用域大致是一样的,JSP中还有动作,常用的有操作JavaBean的动作,页面跳转的动作,以及包含的动作。这里重点提到两种包含的区别。在JSP还讲过jstl和EL表达式,都是基础的应用,不过写自定义的标签还是要有一定的java基础的,我开始不太理解标签的解析过程,后来看了几个例子,发现自定义的已不是那么难。

jQuery:jQuery可以说是中级部分学的最好的,主要是它方便了,特别是选择器,而且避免了一些浏览器的差异,所以在学习jQuery后,就再也不想用javascript来获取元素了。不仅如此,jQuery中封装的Ajax操作也是非常简单,不需要自己封装一个类,$.get和$.post 能够省去很多麻烦,jQuery的监听事件也是很简单,不需要在标签中添加对应事件,可以动态的绑定事件。还有就是dom操作更是方便。我在学习完Ajax,json后就发现,即使是没有JSP,也能做出一个动态页面出来,只是会存在效率问题。

37

总结:虽然说这上面的知识大部分都掌握了,但是能否灵活运用才是重点,所以在今后的学习中多思考问题是否有多种解决方法。

37

参考文献

[1]周恒,王殊宇.JSP项目开发全程实录[M].北京:清华大学出版社, 2008.

[2]张桂珠,刘丽,陈爱国.Java面向对象程序设计[M].北京:北京邮电大学出版社, 2007. [3]孙卫琴. Tomcat与Java Web开发技术详解(第2版)[M]. 北京:电子工业出版社, 2009. [4]李兴华. 名师讲坛:Java Web开发实战经典基础篇 [M]. 清华大学出版社, 2010. [5]Jim Waldo. Java: The Good Parts [M]. O'Reilly Media, 2010.

[6] Gary Cornell. Core Java. Cay S.Horstmann[M].北京:北京邮电出版社,2008. [7] Sharon Zakhour ... [et al.].The Java tutorial [M].北京:人民邮电出版社,2008.

[8]刘中兵Java研究室.Java高手真经:Java Web核心框架[M].北京:电子工业出版社, 2009.

[9] 车皓阳, 杨眉.UML面向对象建模与设计[M].北京:人民邮电出版社,2009.

[10]殷兆麟等.Web系统与技术:Java Web应用技术[M].北京:国防工业出版社,

37

2008.

因篇幅问题不能全部显示,请点此查看更多更全内容