资源描述
项目名称1J2EE企业级开发架构 通用表单及表格模板11 技术路线11.1采用的技术架构11.2 Struts框架21.3 Struts的工作流程21.4 开发环境21.5 运行环境 32 功能描述32.1 MVC模式示意图32.2 功能模块图43 数据库设计53.1 局部E-R图53.2 整体E-R图64 程序代码说明74.1 主要代码74.1.1 注册代码74.1.2 登陆代码84.1.3 主要功能界面代码104.1.4 相关配置文件代码215 设计效果236 结论26项目名称J2EE企业级开发架构 通用表单及表格模板1 技术路线1.1采用的技术架构 B/S 架构Struts + Hibernate的工程管理系统1.2 Struts框架一个成功的管理网站的构建不仅需要考虑到如何高效快捷的实现系统功能,还要本着可扩展的原则,在一定时期内适应技术发展与功能扩充的需求,同时要给用户提供方便、实用的信息服务,使网站的功能最大化。因此在管理系统的设计中,采用了基于Struts的结构框架设计,采用Struts的结构框架设计的优点有:(1) 可扩展性:Struts框架是基于JSP Model2的设计标准,可以说是MVC设计模式的一种变化类型,其业务逻辑和表示逻辑分开,而且所有默认的设置都可以配置,包括了一系列通用标记扩展,适应复杂的业务形式,具有较强的可扩展性,能满足新业务发展的要求。(2) 标准性和开放性:Struts 框架基于Java语言,而且其基本组件具有统一的标准,在许多运行标准的容器中都工作的非常好,具备优异的可移植性(3) 安全性和高效性Struts具有完善的安全管理机制,Java语言也是当前最安全的语言。采用Struts能使系统具有较高的网络安全性和运行效率,保证提供高质量的网络服务和快速的响应速度。1.3 Struts的工作流程Struts框架的工作流程图:1.4 开发环境JDK1.6+Tomcat6.x+MyEclipse10+MySQL1.5 运行环境 MyEclipse102 功能描述2.1 MVC模式示意图2.2 功能模块图3 数据库设计3.1 局部E-R图3.2 整体E-R图4 程序代码说明 4.1 主要代码 4.1.1 注册代码 Register.jsp:function validusername()var u=document.all(username).value;/ 通过document对象取得页面中名为username的元素,再取其值if(u=null|u=)/ 判断是否为空alert(用户名不能为空);function validpasswd(obj)var p=obj.value;/ obj在调用时被传入了this,this代表当前对象即调用方法的password元素var r = new RegExp(d3,$);/ 创建正则表达式规则if(!r.test(p)/ 用正则表达式测试p的值 alert(数字格式不正确); 用 户 名 密码 再次输入 姓名 所属部门 联系电话 返回上一层 注册界面预览:4.1.2 登陆代码Login.jsp工程管理系统$(document).ready(function()$(#login_sub).click(function()$(#submitForm).attr(action, Project.jsp).submit();););/*回车事件*/function EnterPress(e) /传入 event var e = e | window.event; if(e.keyCode = 13) $(#submitForm).attr(action, Project.jsp).submit(); 用户名:密 码: 注册账号 忘记密码 4.1.3 主要功能界面代码Project.jsp/*退出系统*/function logout()if(confirm(您确定要退出本系统吗?)window.location.href = login.html;/*获得当前日期*/function getDate01()var time = new Date();var myYear = time.getFullYear();var myMonth = time.getMonth()+1;var myDay = time.getDate();if(myMonth -1) art.dialog(icon:error, title:友情提示, drag:false, resize:false, content:由于360浏览器功能限制,加入收藏夹功能失效, ok:true,); else if (ua.indexOf(msie 8) -1) window.external.AddToFavoritesBar($dynamicURL/authority/loginInit.action,贝塔工程信息管理系统管理);/IE8 else if (document.all) window.external.addFavorite($dynamicURL/authority/loginInit.action,贝塔工程信息管理系统管理); else art.dialog(icon:error, title:友情提示, drag:false, resize:false, content:添加失败,请用ctrl+D进行添加, ok:true,); /* zTree插件加载目录的处理 */var zTree;var setting = view: dblClickExpand: false,showLine: false,expandSpeed: ($.browser.msie & parseInt($.browser.version)=6)?:fast,data: key: name: resourceName,simpleData: enable:true,idKey: resourceID,pIdKey: parentID,rootPId: ,callback: / beforeExpand: beforeExpand,/ onExpand: onExpand,onClick: zTreeOnClick; var curExpandNode = null;function beforeExpand(treeId, treeNode) var pNode = curExpandNode ? curExpandNode.getParentNode():null;var treeNodeP = treeNode.parentTId ? treeNode.getParentNode():null;for(var i=0, l=!treeNodeP ? 0:treeNodeP.children.length; i0) for (var i = Math.min(newParents.length, oldParents.length)-1; i=0; i-) if (newParentsi != oldParentsi) zTree.expandNode(oldParentsi, false);break;else zTree.expandNode(oldParentsoldParents.length-1, false);curExpandNode = newNode;function onExpand(event, treeId, treeNode) curExpandNode = treeNode;/* 用于捕获节点被点击的事件回调函数 */function zTreeOnClick(event, treeId, treeNode) var zTree = $.fn.zTree.getZTreeObj(dleft_tab1);zTree.expandNode(treeNode, null, null, null, true);/ zTree.expandNode(treeNode);/ 规定:如果是父类节点,不允许单击操作if(treeNode.isParent)/ alert(父类节点无法点击哦.);return false;/ 如果节点路径为空或者为#,不允许单击操作if(treeNode.accessPath= | treeNode.accessPath=#)/alert(节点路径为空或者为#哦.);return false; / 跳到该节点下对应的路径, 把当前资源ID(resourceID)传到后台,写进Session rightMain(treeNode.accessPath); if( treeNode.isParent ) $(#here_area).html(当前位置:+treeNode.getParentNode().resourceName+ +treeNode.resourceName+); else $(#here_area).html(当前位置:系统 +treeNode.resourceName+); ;/* 上方菜单 */function switchTab(tabpage,tabid)var oItem = document.getElementById(tabpage).getElementsByTagName(li); for(var i=0; ioItem.length; i+) var x = oItemi; x.className = ;if(left_tab1 = tabid)$(document).ajaxStart(onStart).ajaxSuccess(onStop);/ 异步加载业务模块下的菜单 loadMenu(YEWUMOKUAI, dleft_tab1);else if(left_tab2 = tabid)$(document).ajaxStart(onStart).ajaxSuccess(onStop);/ 异步加载系统管理下的菜单loadMenu(XITONGMOKUAI, dleft_tab1);else if(left_tab3 = tabid)$(document).ajaxStart(onStart).ajaxSuccess(onStop);/ 异步加载其他下的菜单loadMenu(QITAMOKUAI, dleft_tab1); $(document).ready(function()$(document).ajaxStart(onStart).ajaxSuccess(onStop);/* 默认异步加载业务模块目录 */loadMenu(YEWUMOKUAI, dleft_tab1);/ 默认展开所有节点if( zTree )/ 默认展开所有节点zTree.expandAll(true););function loadMenu(resourceType, treeObj)/*$.ajax(type:POST,url:$dynamicURL/authority/modelPart.action?resourceType= + resourceType,dataType : json,success:function(data)/ 如果返回数据不为空,加载业务模块目录if(data != null)/ 将返回的数据赋给zTree$.fn.zTree.init($(#+treeObj), setting, data); alert(treeObj);zTree = $.fn.zTree.getZTreeObj(treeObj);if( zTree )/ 默认展开所有节点zTree.expandAll(true););*/ data = accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:3,resourceName:项目管理,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:37,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:19,resourceName:人员分配,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:37,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:20,resourceName:任务分配,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:2,resourceName:项目进度,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:16,resourceName:待处理项目,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:24,resourceName:已完成项目,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:34,resourceName:缺席人员,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:55,resourceName:空闲人员,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:30,resourceName:统计报表,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:1,resourceCode:,resourceDesc:,resourceGrade:2,resourceID:37,resourceName:系统参数,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:30,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:31,resourceName:甲方概况,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:55,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:44,resourceName:空闲名单,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:24,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:26,resourceName:历史项目,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:16,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:17,resourceName:添加项目,resourceOrder:0,resourceType:, accessPath:house_list.html,checked:false,delFlag:0,parentID:3,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:7,resourceName:工程管理,resourceOrder:0,resourceType:, accessPath:loupanchart.html,checked:false,delFlag:0,parentID:3,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:8,resourceName:工程一览,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:2,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:5,resourceName:进度一览,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:16,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:18,resourceName:终止项目,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:24,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:59,resourceName:项目回顾,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:34,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:35,resourceName:人员信息,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:2,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:6,resourceName:进度导出,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:3,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:32,resourceName:资金管理,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:3,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:39,resourceName:其他,resourceOrder:0,resourceType:, accessPath:,checked:false,delFlag:0,parentID:2,resourceCode:,resourceDesc:,resourceGrade:3,resourceID:9,resourceName:其他,resourceOrder:0,resourceType:; / 如果返回数据不为空,加载业务模块目录 if(data != null) / 将返回的数据赋给zTree $.fn.zTree.init($(#+treeObj), setting, data);/ alert(treeObj); zTree = $.fn.zTree.getZTreeObj(treeObj); if( zTree ) / 默认展开所有节点 zTree.expandAll(true); /ajax start functionfunction onStart()$(#ajaxDialog).show();/ajax stop functionfunction onStop()/ $(#ajaxDialog).dialog(close);$(#ajaxDialog).hide(); :admin: $(function()$(#TabPage2 li).click(function()var index = $(this).index();$(this).find(img).attr(src, images/common/+ (index+1) +_hover.jpg);$(this).css(background:#fff);$(#nav_module).find(img).attr(src, images/common/module_+ (index+1) +.png);$(#TabPage2 li).each(function(i, ele)if( i!=index )$(ele).find(img).attr(src, images/common/+ (i+1) +.jpg);$(ele).css(background:#044599););/ 显示侧边栏switchSysBar(true););/ 显示隐藏侧边栏$(#show_hide_btn).click(function() switchSysBar(); ););/*隐藏或者显示侧边栏*/function switchSysBar(flag)var side = $(#side); var left_menu_cnt = $(#left_menu_cnt);if( flag=true )/ flag=trueleft_menu_cnt.show(500, linear);side.css(width:280px);$(#top_nav).css(width:77%, left:304px); $(#main).css(left:280px);else if ( left_menu_cnt.is(:visible) ) left_menu_cnt.hide(10, linear);side.css(width:60px); $(#top_nav).css(width:100%, left:60px, padding-left:28px); $(#main).css(left:60px); $(#show_hide_btn).find(img).attr(src, images/common/nav_show.png); else left_menu_cnt.show(500, linear);side.css(width:280px);$(#top_nav).css(width:77%, left:304px, padding-left:0px); $(#main).css(left:280px); $(#show_hide_btn).find(img).attr(src, images/common/nav_hide.png); 当前位置:系统 系统介绍 4.1.4 相关配置文件代码Web.xml CharactorEncodingFilter cn.daizhe.util.CharactorEncodingFilter
展开阅读全文