一、页面之间的传参问题

在jsp中,页面是可以通过param对象拿到路由参数的,而当我们采用传统的html方式,这种方法将不再适用。我们可以采取如下的方法来解决这个问题。

在该业务场景下,当我们点击修改后会跳到修改页面,而修改页面需要拿到部门的有关数据,在不使用jsp的情况下我们可以通过session来解决这个问题,当点击修改时,用ajax发送请求给后台,后台在session中设置一个属性来保存数据,随后浏览器发生页面跳转,当修改页面加载完成时发送ajax请求向后台拿session中存放的数据。
该方法的缺点很明显,非常繁琐并且加大的后台的负担,比较合适的解决方式是前台在修改时弹一个弹窗,在弹窗中修改页面而不发生页面跳转。

二、验证码问题


后端

 public void produceYZM(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// 在内存中创建图象int width = 110, height = 30;BufferedImage image = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);// 获取图形上下文Graphics g = image.getGraphics();// 生成随机类Random random = new Random();// 设定背景色g.setColor(getRandColor(200, 250));g.fillRect(0, 0, width, height);// 设定字体g.setFont(new Font("Times New Roman", Font.PLAIN, 20));// 随机产生155条干扰线,使图象中的认证码不易被其它程序探测到g.setColor(getRandColor(160, 200));for (int i = 0; i < 155; i++) {int x = random.nextInt(width);int y = random.nextInt(height);int xl = random.nextInt(12);int yl = random.nextInt(12);g.drawLine(x, y, x + xl, y + yl);}// 取随机产生的认证码(6位数字)String sRand = "";for (int i = 0; i < 6; i++) {String rand = String.valueOf(random.nextInt(10));sRand += rand;// 将认证码显示到图象中g.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));// 调用函数出来的颜色相同,可能是因为种子太接近,所以只能直接生成g.drawString(rand, 13 * i + 6, 16);}// 图象生效g.dispose();//保存验证码到Sessionrequest.getSession().setAttribute("randStr", sRand);System.out.println(request.getSession().getAttribute("randStr"));try {ImageIO.write(image, "JPEG", response.getOutputStream());} catch (Exception e) {System.out.println("验证码图片产生出现错误:" + e.toString());}}public void checkYZM(HttpServletRequest req,HttpServletResponse resp) throws IOException {String code = req.getParameter("code");if(code.equals((String) req.getSession().getAttribute("randStr"))){resp.getWriter().print("flag=true");}else{resp.getWriter().print("flag=false");}}

前端

 $("#yzmImg").click(function () {console.log("切换验证码")$(this).attr("src","Login?method=produceYZM"+"&"+Math.random())})$("#yzm").blur(function(){console.log("失去焦点")$.ajax({url:"Login?method=checkYZM",method:"get",data:{code:$(this).val()},success:function(res){$("#yzm-text").empty()eval(res)if(flag){passYZM = true$("#yzm-text").append("<small>验证码正确</small>")}else{passYZM = false$("#yzm-text").append("<small>验证码错误</small>")}}})})<span><input name="code" type="text" placeholder="验证码" id="yzm"/></span><cite><img src="Login?method=produceYZM" id="yzmImg" width="115px" height="46px"> </cite>

当页面加载完成时或者点击验证码图片时会发送请求切换验证码,验证码图形会发送到前端的img标签中

三、多表查询时出现多个同名字段,但表达的意义不同

<!--    多表查询、自查询 当表中出现同名字段(非连接字段)时需要起别名用来区分--><select id="selectUpdate" resultMap="EmpMap2">select * from employee empjoin dept on emp.deptno=dept.deptnojoin (select empid empid2,realname realname2 from employee) emp2 on emp.mgrid=emp2.empid2where emp.empid=#{param1}</select>
<resultMap id="EmpMap2" type="employee"><id column="empid" property="empid" ></id><result column="password" property="password"></result><result column="deptno" property="deptno"></result><result column="posid" property="posid"></result><result column="mgrid" property="mgrid"></result><result column="realname" property="realname"></result><result column="sex" property="sex"></result><result column="birthdate" property="birthdate"></result><result column="hiredate" property="hiredate"></result><result column="leavedate" property="leavedate"></result><result column="onduty" property="onduty"></result><result column="emptype" property="emptype"></result><result column="phone" property="phone"></result><result column="qq" property="qq"></result><result column="emercontactperson" property="emercontactperson"></result><result column="idcard" property="idcard"></result><association property="dept" javaType="Dept"><id column="deptno" property="deptno"></id><result column="deptname" property="deptname"></result><result column="location" property="location"></result></association><association property="mgr" javaType="employee"><id column="empid2" property="empid"></id><result column="realname2" property="realname"></result></association></resultMap>

四、挂在webapp文件夹下的html文件访问不到的问题

需要在web.xml中添加如下配置

<servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.css</url-pattern></servlet-mapping><servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.html</url-pattern></servlet-mapping><servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.js</url-pattern></servlet-mapping><servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.ico</url-pattern></servlet-mapping><servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.jpg</url-pattern></servlet-mapping><servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.png</url-pattern></servlet-mapping><servlet-mapping><servlet-name>default</servlet-name><url-pattern>*.gif</url-pattern></servlet-mapping>

MyErp-人事管理系统的问题总结相关推荐

  1. java 人事_java版简易人事管理系统

    [实例简介] 通过对java的学习.用开发工具开发的一款简易人事管理系统 [实例截图] [核心代码] 386393HMSs └── HMSs ├── bin │   ├── com │   │   └ ...

  2. Spring Boot实战系列《六》:人事管理系统的登录设计

    Spring Boot实战系列<六>:人事管理系统的登录设计 Spring Boot实战系列<六>:人事管理系统的登录设计 1.前言 在上一篇中教大家在IEDA或者eclips ...

  3. 企业管理系统java web_JavaWeb 基于 web的 企业人事管理系统 Jsp/Servlet 242万源代码下载- www.pudn.com...

    文件名称: JavaWeb下载  收藏√  [ 5  4  3  2  1 ] 开发工具: Java 文件大小: 8310 KB 上传时间: 2015-07-16 下载次数: 0 提 供 者: 汪伟棋 ...

  4. jsp人事管理系统_Jsp+Ssm+Mysql实现的医院人事管理系统源码附带视频运行教程

    项目地址: jsp+ssm+mysql实现的医院人事管理系统源码附带视频运行教程|猿来入此[beta]多用户版IT项目教程源码分享网站​www.yuanlrc.com 今天给大家演示的是一款由jsp+ ...

  5. mysql人事管理系统源代码_人事管理系统(源代码.doc

    人事管理系统(源代码 附录: 毕业设计程序清单 设计题目 人事管理系统 教 学 班: 学生姓名: 学 号: 指导教师: 完成日期: Option Explicit Dim Bupdata As Boo ...

  6. java企业人事管理系统源码_企业人事管理系统完美版源代码 - 源码下载|行业应用软件|企业管理(财务/ERP/EIP等)|源代码 - 源码中国...

    企业人事管理系统完美版源代码 ............................\DataEnvironment.DCA ............................\DataEnv ...

  7. java 课程设计数据库_人事管理系统(java数据库课程设计)+SQL数据库

    [实例简介] 员工各种信息:包括员工的基本信息,如编号.姓名.性别.学历.所属部门.毕业院校.健康情况.职称.职务.奖惩等:员工各种信息的修改:对转出.辞退.退休员工信息的删除:按照一定条件,查询.统 ...

  8. 基于JAVA+SpringMVC+Mybatis+MYSQL的企业人事管理系统

    项目功能: 人事管理系统包括后台管理员登录,用户管理,部门管理,职位管理,员工管理,公告管理,文档管理等模块 页面效果:

  9. 【毕设】jsp+基于JB的人事管理系统(源代码+论文)

    文章目录 目录 系统设计 系统实现 源文件 目录 系统设计 3.1 需求分析 通过调查,根据人事管理的基本需求,要求系统需要完成以下功能: 详细的企业的员工信息管理: 企业员工奖惩信息管理: 企业员工 ...

  10. 基于Android的人事管理系统开发与设计源码(一)

    基于Android开发的人事管理系统 链接:https://blog.csdn.net/yql_617540298/article/details/108553842 上面的链接详细的介绍整个项目,是 ...

最新文章

  1. c语言精品课程网站论文免费下载,【毕业论文_c语言程序设计精品课程网站的研究与实现6喜欢就下吧材料】...
  2. mysql jdbc 分页查询_JDBC与MySQL实现分页查询技术
  3. abort has been called翻译_2020年12月大学英语四级翻译练习题:股票投资_四级
  4. Oracle 数据库字典 sys.obj$ 表中关于type#的解释
  5. ubuntu中启动oracle数据库
  6. 无锡计算机硬件培训,无锡锡山办公软件电脑基础培训随到随学 学会为止
  7. 线性代数应该这样讲(三)-向量2范数与模型泛化
  8. wp7 --缓动动画
  9. Dagoin之modelform组件
  10. java中线程的状态以及线程栈分析
  11. Sutton 强化学习, 21 点游戏的策略蒙特卡洛值预测
  12. 畅销款黑莓应用是怎样构建的?
  13. OpenCV学习(7.13)
  14. mssql2000sp4 sql injection
  15. 斯坦福图机器学习CS224W笔记自用:How Expressive are Graph Neural Networks?
  16. 又拍云php表单,又拍云存储上传插件 - 支持客户端直传、服务端中转、分片上传 – 基于ThinkPHP和Bootstrap的极速后台开发框架...
  17. iPhone 手机存储空间没有了
  18. dw中css目标规则命名,CSS名规则.doc
  19. 【红队攻防】Attack矩阵图
  20. Windows 正在连接xxx...无法打开到主机的连接。在端口xxx:连接失败问题解决

热门文章

  1. Python获取当前时间的时间戳
  2. Python 初步了解科学计算和数据分析
  3. ddd 访问权限_DDD的人事权(72648577)-通常陷阱- 游戏王进阶平台
  4. 计算机关机慢怎么解决方法,电脑关机慢,教您怎么解决电脑关机慢
  5. havok物理引擎快速入门指南翻译
  6. 全国重点学科最好的考研高校
  7. Proxmox VE 7.2 LXC 方式部署openwrt
  8. Array() 和 Array.of() 的区别
  9. MacBook软件包的管理器-Homebrew常用命令
  10. Linux 系统中的 SNMP Trap