admin 管理员组

文章数量: 1184232


2024年3月7日发(作者:forkjoin框架原理)

沈航北方科技学院

JSP程序设计报告

程序名称

学生成绩管理系统

学 系

专 业

班 级

学 号

学生姓名

指导教师

2014年12月

目录

一、设计目的................................................................................................................ 3

二、设计思路................................................................................................................ 3

三、具体实现................................................................................................................ 4

1.功能介绍:.......................................................................................................... 4

2.数据库构成.......................................................................................................... 5

3.程序构成.............................................................................................................. 7

四、设计体会与小结.................................................................................................. 10

附录1-用户手册....................................................................... 错误!未定义书签。

附录2-源程序........................................................................................................... 12

2

一、设计目的

1.通过开发具体系统,了解并熟悉jsp

2.掌握网络编程的一般模式,使用jsp+javabean+servlet编写具体可用的系统

3.通过开发学生成绩管理系统,充分体会MVC模式的优点及在网络开发的流行性,培养运用此模式解决实际问题的能力

4.通过设计系统,在开发过程中碰到问题解决问题的过程中,逐渐提高自己的开发能力

二、设计思路

本系统采用传统的MVC开发模式,即Jsp+Javabean+Servlet,使用mysql数据库。其中Jsp实现视图端,Javabean是模型端,Servlet是控制端。Servlet担当主要逻辑控制,通过接受Jsp传来的用户请求,调用以及初始化JavaBean,再通过Jsp传到客户端,本系统中SqlBean担当主要的与数据库的连接与通信,JavaBean在本系统中主要担当配合Jsp以及Servlet来完成用户的请求,而Jsp主要担当接受与响应客户端。

体系结构图如图1所示:

servlet

Database

请求

Javabean

jsp

响应

图1 体系结构图

3

三、具体实现

1.功能介绍:

管理员端

管理员可以进行的操作如下:

1、对学生信息进行增加、删除、修改、查询

2、对教师信息进行增加、删除、修改、查询

3、对课程信息进行增加、删除、修改、查询

4、查看个人信息并进行性修改

5、查看学生的选课信息、学生的成绩以及排名情况,其中在查看学生排名时,可以根据学生的所学课程和所在专业进行排名查询

6、 对学生的选课信息进行添加、删除等操作

教师端

教师可以进行的操作如下:

1、查看个人信息并修改登录密码

2、查看学生信息,其中包括对学生成绩进行查询与修改,在本系统中,将教师 的成绩录入功能与成绩修改功能合并

3、查看学生的排名情况,包括学生的课程排名与专业排名

学生端

学生可以进行的操作如下:

1、修改个人登录系统的密码

2、查看自己的课表

3、进行选课

4、查询自己成绩以及成绩排名情况,同时拥有通过学号查询其他人成绩的权利

4

框图结构

程序的框图结构如图2所示:

图2 框架结构

2.数据库构成

数据库作为后台数据存储空间,由7张表组成,设计遵循数据库设计要求,力求规范,

各表的结构如下:

manager 管理员信息表

teacher 教师信息表

student 学生信息表

5

course 课程信息表

studentcourse 学生选课信息表

score 学生成绩表

rank 学生平均学分积点表

6

3.程序构成

Jsp

各个输入界面,显示界面,用于信息的输入输出以及显示

Manager:

Teacher:

错误信息显示界面

退出系统

登录界面

添加课程界面

为学生选课界面

添加学生界面

添加教师操作

显示页面的上栏信息

显示页面左栏信息

显示页面右栏信息

划分分配页面比例

查看某个学生成绩界面

显示课程信息界面

显示学生选课信息界面

显示学生信息

显示教师信息

更改课程信息

更改密码界面

更改成绩界面

更改学生信息界面

更改教师信息界面

输入课程号进行排名界面

7

显示按课程排名信息

输入专业名进行排名界面

显示按专业排名信息

查看某个学生成绩界面

显示学生信息

显示个人信息

显示页面的上栏信息

显示页面左栏信息

显示页面右栏信息

划分分配页面比例

更改成绩界面

updateTpassword 更改密码界面

Student

显示页面的上栏信息

显示页面左栏信息

显示页面右栏信息

查看个人成绩

显示其他人成绩

输入要查询其他人的学号界面

选课界面

显示个人选课信息

划分分配页面比例

修改密码

JavaBean

JavaBean定义各种功能类

※sqlBean 对数据库的各种操作

※coursescore 课程成绩信息

8

※student 学生类

※teacher 教师类

※course 课程

※studentcourse 学生选课信息

Servelet

作为整个系统的控制者,Servlet接受Jsp的请求与数据,调用JavaBean完成程序功能,并将结果转交给Jsp显示

各Servlet如下:

Addcourse 添加课程

Addstudent 添加学生

Addteacher 添加教师

Check 验证登录信息

Delcourse 删除课程

Delstucou 删除学生选课信息

Delstudent 删除学生信息

Delteacher 删除教师

M_selectcourse 管理员为学生选课

M_updatescore 管理员更改成绩

Selectcourse 学生选课

Updatecourse 更改课程信息

updateMpassword 更改教师密码

Updatescore 更改成绩

updateSpassword 更改学生密码

Updatestudent 更改学生信息

Updateteacher 更改教师信息

updateTpassword 更改教师密码

9

四、设计体会与小结

通过学生成绩管理系统的设计,我对软件开发又有了更深一些的认识,对MVC模式的特点有了一定的看法。在软件设计中,再碰到问题及解决问题的过程中有了一定的提高。

做程序一定要提前做好规划,这样会避免在系统开发过程中出现混乱,并且在对程序进行修改时也能减少附带的错误。

系统是不可能完美的,我们要做的就是要在现实需求的基础上尽量减少用户操作的繁琐,为用户提供便利,尽量使系统人性化。

要解决问题拖沓,要及时有效地处理问题及及时完成任务,编程是个慢活细活,要有耐性。

要充分利用网络的便利,遇到一些想不通的地方可以上网查询,对平时没有及时对所学的东西进行扩展和提高。同时周围的同学也是很好的老师,有些问题自己想可能想不通,但是让别人帮自己看看就能很轻易解决问题。

不要局限在课本内容,也不要只看课本,最好的方法就是编程,在实践中学习。当碰到问题时就去查资料,去学习,然后把学到的知识运用到程序中,这样对知识的掌握就更加彻底。一开始我采取的办法就是看课本,但是课本看完了,自己还是很头晕,知识点太琐碎,看一遍根本记不住多少东西,后来就采取上面的办法,这样对JSP程序设计理解的越来越清楚。

10

附录1—用户手册

运行程序,程序显示登录界面如图1所示

图1 登录界面

输入用户名和密码后,选择相应的身份,点击登录系统。出现如图2所示的程序界面。

图2 程序运行界面

11

附录2-源程序

package servlet;

import ption;

import riter;

import Set;

import eption;

import tDispatcher;

import tException;

import rvlet;

import rvletRequest;

import rvletResponse;

import ssion;

import n;

public class check extends HttpServlet {

/**

* Constructor of the object.

*/

public check() {

super();

}

/**

* Destruction of the servlet.

12

*/

public void destroy() {

}

y(); // Just puts "destroy" string in log

// Put your code here

/**

* The doGet method of the servlet.

*

* This method is called when a form has its tag value method equals to get.

*

* @param request the request send by the client to the server

* @param response the response send by the server to the client

* @throws ServletException if an error occurred

* @throws IOException if an error occurred

*/

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

tentType("text/html;charset=utf-8");

PrintWriter out = ter();

String id=null;

String password=null;

String kind=null;

id=ameter("id");

HttpSession session=sion(true);

ribute("id", f(id));

password=ameter("password");

kind=ameter("kind");

13

}

/**

sqlBean db=new sqlBean();

String pw="";

String sql="select password from "+kind+" where id='"+id+"'";

ResultSet rs=eQuery(sql);

try{

}

catch(SQLException e){

}

catch(ServletException f){

}

catch(IOException g){

}

n("用户名或密码错误!"+sage());

n("用户名或密码错误!"+sage());

n("用户名或密码错误!"+sage());

("用户名或密码错误!"+sage());

if(()){

}

pw=ing("password");

if((pw))

goo(request,response,kind);

else{

}

n("用户名或密码错误!");

doError(request,response,"用户名或密码错误!");

* The doPost method of the servlet.

*

* This method is called when a form has its tag value method equals to post.

14

*

* @param request the request send by the client to the server

* @param response the response send by the server to the client

* @throws ServletException if an error occurred

* @throws IOException if an error occurred

*/

public void goo(HttpServletRequest request,HttpServletResponse

response,String kind)

throws ServletException,IOException{

if(("student")){

//控制页面跳转

RequestDispatcher

rd=getServletContext().getRequestDispatcher("/student/");

}

if(("teacher")){

RequestDispatcher

d(request, response);

rd=getServletContext().getRequestDispatcher("/teacher/");

}

if(("manager")){

RequestDispatcher

d(request, response);

rd=getServletContext().getRequestDispatcher("/manager/");

}

public void doError(HttpServletRequest request,HttpServletResponse

}

d(request, response);

response,String str)

throws ServletException,IOException{

ribute("problem", str);

15

");

getServletConfig().getServletContext().getRequestDispatcher("/}

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

doGet(request,response);

}

/**

* Initialization of the servlet.

*

* @throws ServletException if an error occurs

*/

public void init() throws ServletException {

// Put your code here

}

}

package servlet;

import ption;

import riter;

import .*;

import tException;

import rvlet;

import rvletRequest;

import rvletResponse;

import ssion;

import tcourse;

16

import ;

import score;

public class selectcourse extends HttpServlet {

/**

* Constructor of the object.

*/

public selectcourse() {

}

super();

/**

* Destruction of the servlet.

*/

public void destroy() {

}

y(); // Just puts "destroy" string in log

// Put your code here

/**

* The doGet method of the servlet.

*

* This method is called when a form has its tag value method equals to get.

*

* @param request the request send by the client to the server

* @param response the response send by the server to the client

* @throws ServletException if an error occurred

* @throws IOException if an error occurred

*/

17

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

racterEncoding("utf-8");

tentType("text/html;charset=utf-8");

PrintWriter out = ter();

String sid,cid,clsid;

HttpSession session=sion();

sid=(String)ribute("id");

cid=ameter("cid");

course cou=new course();

studentcourse selcou=new studentcourse();

coursescore sc=new coursescore();

(sid);

if(d(sid,cid)==false){

ResultSet rs=fo(cid);

try {

while(()){

(sid);

(cid);

um(ing("clnum"));

me(ing("cname"));

dit(ble("credit"));

acity(("capacity"));

course();

("选课成功!正在返回,请稍候……");

der("refresh",

"2;url=/stu_score_ms/student/");

}

} catch (NumberFormatException e) {

18

}

tackTrace();

} catch (SQLException e){

}

tackTrace();

else{

("对不起,您已经选过该课程了!");

der("refresh",

"2;url=/stu_score_ms/student/");

}

}

/**

* The doPost method of the servlet.

*

* This method is called when a form has its tag value method equals to post.

*

* @param request the request send by the client to the server

* @param response the response send by the server to the client

* @throws ServletException if an error occurred

* @throws IOException if an error occurred

*/

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

tentType("text/html");

PrintWriter out = ter();

out

.println("

19

Transitional//EN">");

}

public void doError(HttpServletRequest request,HttpServletResponse

n("");

n(" A Servlet");

n(" ");

(" This is ");

(ss());

n(", using the POST method");

n(" ");

n("");

();

();

response,String str)

throws ServletException, IOException {

ribute("problem", str);

uestDispatcher("/").forward(request,

response);

}

20

}

/**

* Initialization of the servlet.

*

* @throws ServletException if an error occurs

*/

public void init() throws ServletException {

}

// Put your code here

完成日期:2014年12月31日21


本文标签: 信息 学生 系统 显示 界面