孙延正《管理信息系统开发实践》设计方案成果报告_第1页
孙延正《管理信息系统开发实践》设计方案成果报告_第2页
孙延正《管理信息系统开发实践》设计方案成果报告_第3页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、山东建筑大学课程 设计成 果报告题 目: 课 程: 院(部): 专 业: 班 级: 学生姓名: 学 号: 指导教师: 完成日期:1. 系统功能简介本系统是毕业设计管理系统中教师、教研室主任用户的部分功能。系统 向教师用户提供了查看已经提交的题目、提交题目并且可以进行修改和删除功 能,向教研室主任提供了查询、审批的功能。使用 eclipse-jee-europa-winter-win32 +Jdk1.6+Tomcat6开发、测试。login.jsp LoginServletGraduatePrqje ctS e rvlet3.增加题冃-weicome.jsp1. 用户信息2. 査肴题国doGet

2、()doPostf)2. 系统组件关系listGrad uateProject jsp-addGraduateProject jspeditGraduatePrqject.jsp1 増加题目2删除题冃 汶修改题冃本系统使用构架进行开发,即使用JSP获得用户输入,由 Servlet处理请求,将数据存入服务器对象(session或request)中。JSP使用EL表达式和JSTL标签将数据从服务器对 象中取出数据,展示出来。2.1. 登录功能的处理流程:login.jsp收集用户的输入,点击"提交”按钮后,由LoginServlet的doPost方法获得jsp 页面的username、p

3、assword参数的值,如果是合法用户,则将userlnfo存入session并转向welcome.js 页面,否则将"用户名或密码错误"以“error”为名存入session,转回login.jsp,该页面显示error 的内容。2.2. weicome.jsp页面功能2.2.1. 查看所有设计题目221.1. 单击超链接“查看所有设计题目”,即请求GraduateProjectServlet的doGet 方法,由于没有其它参数,会直接执行该类的 list 方法。在 list 方法中, 通 过 GraduateProjectDao 获 得 所 有 的 设 计 题 目 对

4、象 的 集 合 , 以 “ graduateProjects” 为 名 存 入 request , 然 后 请 求 被 转 发 到 listGraduateProject.jsp。在该页面中,通过 JSTL的forEach标签遍历 graduateProjects的每个题目对象,依次将它们的所有属性显示出来。如 果某题目的指导教师与登录用户相同,且未被批准,则在后面列出“修 改、删除”超链接。. 单击“修改”链接,会请求 GraduateProjectServlet的doGet方法,同时 将参数 action=prepareEdit 和 id 传入。 doGet 方法解析参数后,

5、通过 GraduateProjectDao 获得参数 id 所代表的 GraduateProject 对象,以“ prepareObjects ” 为 名 存 入 request , 然 后 请 求 被 送 到 editGraduateProject.jsp在该页面中,通过 JSTL的forEach标签遍历 prepareObjects的每个题目对象,同时一次将他们的属性显示出来。然后 老师根据自己的论文特点作相应的修改,最后有一个“提交”按钮,点 击即可以实现对其的修改。. 单击“删除”链接,会请求 GraduateProjectServlet的doGet方法,同时 将参数ac

6、tion=delete和id传入。doGet方法解析参数后,由Integer重新 定义并得到id,之后直接执行request的delete操作,即删除对应项目的 id。那么再次返回到listGraduateProject.jsp页面时,所删除的那个不会再 次出现。因为其id已经被delete掉了。. 单击“增加设计题目”链接 (参见 2.2.2)2.2.2. 增加设计题目. 浏览所有题单击“提交题目”,会请求GraduateProjectServlet的 doPost方法,将 参数action=add和id传入。doPost方法解析参数,通过GraduateProj

7、ectDao 获 得 id 所 对 应 的 所 有 的 题 目 对 象 的 集 合 。 之 后 返 回 到 addGraduateProject.jspK面,通过 JSTL 的 forEach 标签遍历 graduateProjects 的所有对象,依次将其属性显示出来。 之后用户就可以浏览所有的题目了2222审批题目审批是教研室主任特有的功能。单击“审批题目”时,会请求GraduateProjectServlet4DepartmentLeade的 doPost方法。3.源程序3.1. 实体类(省略方法),共XX个。1、Degree.javaackage cn. edu.sdjzu.xg11.

8、doma in;import java.io.Serializable;public final class Degree implements Comparable<Degree>,Serializableprivate In teger id;private String description ;private Str ing no;private Str ing remarks;2、Department.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final class

9、Department implements Comparable<Department>,Serializableprivate In teger id;private String description ;private Str ing no;private Str ing remarks;private School school;3、GraduateProject.javapackage cn .edu.sdjzu.xg11.doma in;import java.io.Serializable;import java.util.Collecti on;public fin

10、al class GraduateProject impleme nts Comparable<GraduateProject>,Serializableprivate static In teger n extID = 11;private In teger id;private String title;限选专业private Collect on<M ajor> limitedToMajor;类别private Projectcategory projectcategory;类型private ProjectType projectType;性质来源状态priva

11、te GraduateProjectStatus graduateProjectStatus;private Teacher teacher;初始化块this.id = n extID;n extlD+;System.out.pri ntln ("N");4、GraduateProjectStatus.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final classGraduateProjectStatus implementsComparable<Graduat

12、eProjectStatus>,Serializableprivate In teger id;private String description ;private Str ing no;private Str ing remarks;5、Majors.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final class Major implements Comparable<Major>,Serializableprivate In teger id;private St

13、ring description ;private Str ing no;private Str ing remarks;private Departme nt departme nt;6、ProjectCategory.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final class Projectcategory implements Comparable<ProjectCategory>,Serializableprivate In teger id;private St

14、ring description ;private Str ing no;private Str ing remarks;7、ProjectType.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final classProjectType implements Comparable<ProjectType>,Serializable private In teger id;private String description ;private Str ing no;private

15、 Str ing remarks;8、School.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final class School implements Comparable<School>,Serializableprivate In teger id;private String description ;private Str ing no;private Str ing remarks;9、Teacher.javapackage cn .edu.sdjzu.xg11.d

16、oma in;import java.io.Serializable;import java.util.Set;import cn. edu.sdjzu.xg11.doma in. authority.Actor;public final class Teacher exte nds Actor impleme nts Comparable<Teacher>,Serializable /*/private static final long serialVers ionUID = 1L;private In teger id;private String name;private

17、Title title;private Degree degree;private Departme nt departme nt;private Set<GraduateProject> projects;10、Title.javapackage cn. edu.sdjzu.xg11.doma in;import java.io.Serializable;public final class Titleimplements Comparable<Title>,Serializableprivate In teger id;private String descript

18、ion ;private Str ing no;private Str ing remarks;11、User In fo.javapackage cn .edu.sdjzu.xg11.doma in;import java.io.Serializable;import java.util.Date;public class UserI nfoimpleme nts Comparable<User In fo>,Serializableprivate In teger id;private String user name;private String password;priva

19、te Date log in Time;private Teacher teacher;12、Actory.javapackage cn. edu.sdjzu.xg11.doma in. authority;import java.util.Collection;public abstract classActor private Collecti on< ActorAssRole> actorAssRoles;13、ActorAssRole.java/package cn .edu.sdjzu.xg11.doma in .authority;import java.io.Seri

20、alizable;import java.util.Date;import util.lDService;public class ActorAssRole impleme nts Comparable<ActorAssRole>,Serializableprivate In teger id;private Actor actor;private Role role;private Date createTime;this.id = IDService.getID();14、AuthorityTest.javapackage cn .edu.sdjzu.xg11.doma in

21、.authority;import java.util.Collecti on;import java.util.Date;import java.util.HashSet;import cn. edu.sdjzu.xg11.dao.TeacherDao;import cn. edu.sdjzu.xg11.dao.authority.ActorAssRoleDao;import cn. edu.sdjzu.xg11.dao.authority.ResourceDao;import cn. edu.sdjzu.xg11.dao.authority.RoleDao;import cn. edu.s

22、djzu.xg11.doma in. Teacher;public class AuthorityTest public static void main(String args) Teacher t1 = TeacherDao.get In sta nce().getTeacher(1);Teacher t2 = TeacherDao.getI nsta nce().getTeacher(2);/Role r1 = RoleDao.get In sta nce().getRole(1);Role r2 = RoleDao.get In sta nce().getRole(2);/ActorA

23、ssRole ar1 = ActorAssRoleDao.getI nsta nce().getActorAssRole(1);ActorAssRole ar21 = ActorAssRoleDao.getI nsta nce().getActorAssRole(2);ActorAssRole ar22 = ActorAssRoleDao.getI nsta nce().getActorAssRole(3);Collectio n<ActorAssRole> t1R = new HashSet<ActorAssRole>();t1R.add(ar1);t1.setAct

24、orAssRoles(t1R);Collectio n<ActorAssRole> t2R = new HashSet<ActorAssRole>();t2R.add(ar21);t2R.add(ar22);t2.setActorAssRoles(t2R);打印角色Collectio n<ActorAssRole> t1r = t1.getActorAssRoles();for (ActorAssRole asr : t1r) System.out.pri ntl n(asr.getActor().getName()+"/"+asr.ge

25、tRole().getDescriptio n();Collectio n<ActorAssRole> t2r = t2.getActorAssRoles();for (ActorAssRole asr : t2r) System.out.pri ntl n(asr.getActor().getName()+"/"+asr.getRole().getDescriptio n(); Resource rs11 = ResourceDao.getI nsta nce().getResource(1);Resource rs12 = ResourceDao.getI

26、nsta nce().getResource(2);Resource rs21 = ResourceDao.get In sta nce().getResource(3);RoleAssResource rRs11 = new RoleAssResource(r1,rs11, new Date();RoleAssResource rRs12 = new RoleAssResource(r1,rs12, new Date();RoleAssResource rRs21 = new RoleAssResource(r2,rs21, new Date();角色1Collecti on <Rol

27、eAssResource> roleAssResource1 = new HashSet<RoleAssResource>();roleAssResource1.add(rRs11);roleAssResource1.add(rRs12);r1.setRoleAssResource(roleAssResource1);角色2Collecti on <RoleAssResource> roleAssResource2 = new HashSet<RoleAssResource>();roleAssResource2.add(rRs21);r2.setRo

28、leAssResource(roleAssResource2);System.out.println("/ 打印资源");for (ActorAssRole asr : t1r) System.out.pri ntl n(asr.getActor().getName()+"/"+asr.getRole().getDescriptio n();Collecti on <RoleAssResource> rRs = asr.getRole().getRoleAssResource();for (RoleAssResource roleAssRes

29、ource : rRs) System.out.pri nt("t");System.out.pr intln(rol eAssResource.getResource().getDescripti on() + "="+roleAssResource.getResource().getUrl();System.out.println("/ 打印资源 22");for (ActorAssRole asr : t2r) System.out.pri ntl n(asr.getActor().getName()+"/"

30、+asr.getRole().getDescriptio n();Collecti on <RoleAssResource> rRs = asr.getRole().getRoleAssResource(); for (RoleAssResource roleAssResource : rRs) System.out.pri nt("t");System.out.pr intln(rol eAssResource.getResource().getDescripti on() + "="+roleAssResource.getResource

31、().getUrl();System.out.println("/ 打印资源 3");Collectio n<ActorAssRole> t1ar = t2.getActorAssRoles();System.out.pri ntln (t1);for (ActorAssRole actorAssRole : t1ar) System.out.pri ntl n(actorAssRole.getRole();Collecti on <RoleAssResource> rrs = actorAssRole.getRole().getRoleAssRes

32、ource(); for (RoleAssResource roleAssResource : rrs) System.out.pri ntl n(roleAssResource.getResource();15、Resource.javapackage cn .edu.sdjzu.xg11.doma in .authority;import java.io.Serializable;import util.IDService;public class Resource impleme nts Comparable<Resource>,Serializable private st

33、atic int n extlD=1;private In teger id;private String description;private String url;private String no;this.id=IDService.getID();16、Role.javaackage cn. edu.sdjzu.xg11.doma in. authority;import java.io.Serializable;import java.util.Collecti on;import util.IDService;public final class Role implements

34、Comparable<Role>,Serializable private static int n extlD=1;private In teger id;private String description;private String no;private Collecti on <RoleAssResource> roleAssResource;17、RoleAssResource.javapackage cn .edu.sdjzu.xg11.doma in .authority;import java.io.Serializable;import java.u

35、til.Date;public class RoleAssResourceimpleme nts Comparable<RoleAssResource>,Serializableprivate static int n extID=1;private In teger id;private Role role;private Resource resource;private Date createTime;this.id = n extID;n extID+;3.2. Dao 类(略)3.3. Servlet 类,共 2 个。1、GraduateProjectServIepack

36、age acti on;import java.i o.I OExcepti on;import java.util.Collect ion;import java.util.HashSet;import javax.servlet.ServletExceptio n; import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResp on se;import javax.servlet.http.HttpSessi on;import cn. edu.sdjzu.xgll.dao.Gr

37、aduateProjectDao;import cn. edu.sdjzu.xg11.dao.GraduateProjectStatusDao;import cn. edu.sdjzu.xg11.dao.MajorDao;import cn. edu.sdjzu.xg11.dao.ProjectCategoryDao;import cn. edu.sdjzu.xg11.dao.ProjectTypeDao;import cn .edu.sdjzu.xg11.domai n.GraduateProject;import cn. edu.sdjzu.xg11.doma in. GraduatePr

38、ojectStatus;import cn. edu.sdjzu.xg11.doma in.M ajor;import cn. edu.sdjzu.xg11.doma in .Projectcategory;import cn. edu.sdjzu.xg11.doma in .ProjectType;import cn. edu.sdjzu.xg11.doma in. Teacher;import cn. edu.sdjzu.xg11.doma in. Userl nfo;* Servlet impleme ntati on class for Servlet: GraduateProject

39、Servlet*/public class GraduateProjectServlet exte nds javax.servlet.http.HttpServletimpleme nts javax.servlet.Servlet static fin al l ong serialVers ionUID = 1L;private Collect ion <ProjectCategory> categories;private Collect ion <ProjectType> types;private Collect ion<Major> major

40、s;public GraduateProjectServlet。super();protected void doPost(HttpServletRequest request,HttpServletResp onse resp on se) throws ServletExcepti on, I OExcepti on HttpSessi on sessi on = request.getSessi on();UserI nfo userI nfo = (UserI nfo) sessi on. getAttribute("userI nfo");Teacher teac

41、her = userI nfo.getTeacher();request.setCharacterE ncodi ng("UTF-8");String action = request.getParameter("act ion ”);if ("add".equals(action) String projectTitle = request.getParameter("title");String category_id = request.getParameter("category");String

42、 type_id = request.getParameter("type");Strin g majors_ids = request.getParameterValues("majors"); System.out.pri ntln(m ajors_ids);ProjectCategory category = ProjectCategoryDao.getI nsta nce().getProjectCategory(new Integer(category id);ProjectType type = new ProjectTypeDao().ge

43、tProjectType( new In teger(type_id);Collectio n< Majorlimitedmajors = new HashSet<Major>(); if(majors_ids=n ull)MajorDao majorDao = MajorDao.getl nsta nce();如果用户未选择适用专业,则将该教师所属教研室的所有专业设置为适用专业”Collect ion<Major> allMajors = MajorDao.get In sta nce().getMajors();for (Major major : allMa

44、jors) if(major.getDepartme nt().equals(teacher.getDepartme nt() limitedmajors.add(major);elsefor (Stri ng majorld : majors_ids) Major major = MajorDao.get In sta nce().getMaj or(n ew In teger(majorld); limitedmajors.add(major);System.out.pri ntln( teacher);GraduateProjectStatussuppe ndStatusGraduate

45、ProjectStatusDao.getI nsta nce().getGraduateProjectStatus(1);GraduateProject projectcategory = new GraduateProject(projectTitle, limitedmajors, category, type, suppe ndStatus,teacher);GraduateProjectDao.get In sta nce().addGraduateProject(projectCategory);else if("update".equals(act ion)Sy

46、stem.out.pri ntln(action);String id_str = request.getParameter("id");GraduateProject project = GraduateProjectDao.getI nsta nce().getGraduateProject( newIn teger(id_str);String projectTitle = request.getParameter("title");String category_id = request.getParameter("category&q

47、uot;);String type_id = request.getParameter("type");Strin g majors_ids = request.getParameterValues("majors");Projectcategory category = ProjectCategoryDao.getI nsta nce().getProjectCategory( new In teger(category_id);ProjectType type = new ProjectTypeDao().getProjectType( new In

48、 teger( type_id);Collectio n< Majorlimitedmajors = new HashSet<Major>();for (Stri ng majorld : majors_ids) Major major = MajorDao.get In sta nce().getMaj or(n ew In teger(majorld); limitedmajors.add(major);project.setTitle(projectTitle);project.setProjectCategory(category);project.setProjec

49、tType(type);project.setLimitedToMajor(limitedmajors);GraduateProjectDao.get In sta nce().updateGraduateProject(project);this .li st(request, resp on se);protected void doGet(HttpServletRequest request,HttpServletResp onse resp on se) throws ServletExcepti on, I OExcepti on HttpSessi on sessi on = re

50、quest.getSessi on();String action = request.getParameter("act ion ”);if ("delete".equals(action) /刪除String id_s = request.getParameter("id");In teger id = new In teger(id_s);this.delete(request, resp on se, id); else if ("prepareAdd".equals(act ion) prepareObjects(

51、request);/ jsp request.getRequestDispatcher("/dPages/addGraduateProject.jsp").forward(request, resp on se);return;else if("prepareEdit".equals(act ion)prepareObjects(request);String id = request.getParameter("id");GraduateProjectgraduateProject=GraduateProjectDao.getI n

52、sta nce().getGraduateProject( new In teger(id);request.setAttribute("graduateProject", graduateProject);/ jsp request.getRequestDispatcher("/dPages/editGraduateProject.jsp").forward(request, resp on se);return;Iist(request, resp on se);private void prepareObjects(HttpServletReque

53、st request) categories = ProjectCategoryDao.getl nsta nce().getProjectCategorys();types = new ProjectTypeDao().getProjectTypes();majors = MajorDao.get In sta nce().getMajors();/保存到session中request.setAttribute("categories", categories);request.setAttribute("types", types); request

54、.setAttribute("majors", majors);private void delete(HttpServletRequest request,HttpServletResp onse resp on se, In teger id) throws ServletExcepti on, IOExcepti on System.out.println("delete id=" + id);Collect ion< GraduateProject> projects = GraduateProjectDao.get In sta n

55、ce().getGraduateProjects();projects.remove( new GraduateProject(id);private void list(HttpServletRequest request, HttpServletResp onse resp on se)throws ServletExcepti on, I OExcepti on Collect ion< GraduateProject> projects =GraduateProjectDao.get In sta nce().getGraduateProjects();System.out

56、.pri ntln( projects.size();int coun ter=1;final Stri ng TAB="t"for (GraduateProject graduateProject : projects) System.out.pri nt(co un ter+)+TAB);System.out.pri nt(graduateProject.getTitle()+TAB);System.out.pri nt(graduateProject.getProjectCategory().getDescriptio n()+TAB);System.out.pri

57、nt(graduateProject.getProjectType().getDescripti on()+TAB);System.out.pri nt(graduateProject.getTeacher().getName()+TAB);System.out.pri ntl n();HttpSessi on sessi on = request.getSessi on();sessi on. setAttribute("projects", projects);request.getRequestDispatcher(respon se.e ncodeURL("

58、;./dPages/listGraduateProject.jsp").forward(request, resp on se);2、LoginServlet.javapackage logi n;import java.i o.I OExcepti on;import java.util.Collect ion;import javax.servlet.RequestDispatcher;import javax.servlet.ServletExceptio n;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResp on se;import javax.servlet.http.HttpSessi on;import cn. edu.sdjzu.xg11.dao.Userl nfoDao;import cn. edu.sdjzu.xg11.doma in. Userl nfo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论